override public IDbCommand CreateCommand() { MySQLConnection sc = InternalConnection as MySQLConnection; if (null == sc) { throw new InvalidOperationException("InvalidConnType00" + InternalConnection.GetType().FullName); } return(sc.CreateCommand()); }
public MySQLDataReader GetDataReader(string commandStr) { connection.Open(); MySQLCommand cmdTemp = (MySQLCommand)connection.CreateCommand(); cmdTemp.CommandText = "set names gbk"; cmdTemp.ExecuteNonQuery(); command = (MySQLCommand)connection.CreateCommand(); command.CommandText = commandStr; dataReader = (MySQLDataReader)command.ExecuteReader(); return(dataReader); }
static void Main(string[] args) { Console.WriteLine("Connect to MySql"); using (connection) { try{ connection.Open(); System.Console.WriteLine("Koneksi: " + connection.State.Tostring() + Enviroment.NewLine); MySqlCommand command = connection.CreateCommand(); command.CommandText = System.Data.CommandType.Text; command.CommandText = "Select * from guitar"; MySqlDataReader reader = command.ExecuteReader(); var data = "[type]\t[brand]\t[bodytype]\t[price]\n"; if (reader.Hashrow) { while (reader.Read()) { data += reader.GetString(0) + reader.Getstring(1) + reader.GetString(2) + reader.GetInt(3); +Environment.NewLine; } Console.WriteLine(data); } else { Console.WriteLine("Data Unknown") } reader.Close(); connection.Close(); System.Console.WriteLine("Koneksi: " + connection.State.Tostring() + Enviroment.NewLine); } catch (My.Sql.Data.MySqlClient.MySqlException ex) { System.Console.WriteLine("eror " + ex.Message.Tostring()); Console.Readkey(); } finally{ System.Console.WriteLine("Exit..."); Console.Readkey(); } } }
// X:\jsc.svn\examples\java\hybrid\Test\TestJVMCLRAsync\TestJVMCLRAsync\Program.cs // can we send in the caller IButtonProxy ? // as long the interface is async, one way we could do it. // if it allows a continuation we would have // to reinit our state // this would be possible only if we encrypt and sign // our state // as we cannot trust the other device to not change our expected state static ApplicationWebService() { // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestAppEngineOrderByThenGroupBy\ApplicationWebService.cs // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201409/20140908 // jsc should not try to do cctor on client side // X:\jsc.svn\examples\javascript\Test\TestWebServiceStaticConstructor\TestWebServiceStaticConstructor\ApplicationWebService.cs #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { Console.WriteLine("enter WithConnection"); //var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { //Database = UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { //var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? //var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); var QDataSource = "TestAppEngineOrderByThenGroupBy"; // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); // jsc java does the wrong thing here cc0.Close(); //cc0.Dispose(); Console.WriteLine("exit WithConnection"); }; #endregion }
static void Main(string[] args) { #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now //var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; //// --standalone --console //var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(3000); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "tssl", Server = "192.168.1.211", // password is useless if client cert is to be used Password = "******", SslMode = MySQLSslMode.Required, // private key CertificateFile = @"X:\Monese\network\certs\local_devsql1\local_sql_client.pfx", //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion new PerformanceResourceTimingData2ApplicationPerformance().Delete(); new PerformanceResourceTimingData2ApplicationPerformance().Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectEnd = 9, connectStart = 5, Tag = "first insert" }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 111, Tag = "middle insert" }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 11, Tag = "Last insert, selected by group by" } ); // https://code.google.com/p/chromium/issues/detail?id=369239&can=5&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified var f = ( from x in new PerformanceResourceTimingData2ApplicationPerformance() //orderby x.Key ascending // MYSQL and SQLITE seem to behave differently? in reverse actually! orderby x.connectEnd descending // { f = { c = 3, Tag = first insert } } //orderby x.Key ascending // { f = { c = 3, Tag = Last insert, selected by group by } } // { f = { c = 3, Tag = first insert } } group x by x.connectStart into gg select new { c = gg.Count(), // need orderby x.Key descending ! gg.Last().Tag } ).FirstOrDefault(); System.Console.WriteLine( new { f } ); //mysqldp.CloseMainWindow(); Debugger.Break(); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now //var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; var mysqld = @"X:\util\xampp-win32-1.8.3-5-VC11\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // C:\util\xampp\mysql\bin\mysqld.exe --defaults-file=C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\my.ini mysql // already running as a service? //151019 12:23:06 InnoDB: Operating system error number 32 in a file operation. //InnoDB: The error means that another program is using InnoDB's files. //InnoDB: This might be a backup or antivirus software or another instance //InnoDB: of MySQL. Please close it to get rid of this error. // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(3000); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); // Additional information: Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'localhost' (using password: NO) // https://www.apachefriends.org/download.html #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteNonQuery(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteNonQuery(); } #endregion y(cc0); cc0.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); Debugger.Break(); // + $exception {"Process has exited, so the requested information is not available."} System.Exception {System.InvalidOperationException} mysqldp.CloseMainWindow(); }
static void Main(string[] args) { #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(3000); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion new PerformanceResourceTimingData2ApplicationPerformance().Delete(); new PerformanceResourceTimingData2ApplicationPerformance().Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectEnd = 9, connectStart = 5, Tag = "first insert" }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 111, Tag = "middle insert" }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 11, Tag = "Last insert, selected by group by" } ); // https://code.google.com/p/chromium/issues/detail?id=369239&can=5&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified var f = ( from x in new PerformanceResourceTimingData2ApplicationPerformance() //orderby x.Key ascending // MYSQL and SQLITE seem to behave differently? in reverse actually! orderby x.connectEnd ascending // { f = { c = 3, Tag = first insert } } group x by x.connectStart into gg select new { c = gg.Count(), // need orderby x.Key descending ! gg.Last().Tag } ).FirstOrDefault(); System.Console.WriteLine( new { f } ); mysqldp.CloseMainWindow(); Debugger.Break(); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(500); #region MySQLConnection // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion //'TestXMySQL.PerformanceResourceTimingData2ApplicationPerformanceRow' cannot be used for delegate parameter of type 'System.Object' // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); //n.Create(); // wont return? jsc broke xMySQL async? no there was an sql error //var count = n.CountAsync(cc0).Result; var count = n.Count(); // ScriptCoreLib.Async n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0) } // if you do not wait you wont get the id damn it ); // should be based on QueryExpressionBuilder.Dialect, and wait for the last async? //var id = cc0.GetLastInsertRowId(); // http://stackoverflow.com/questions/5440168/c-sharp-mysql-there-is-already-an-open-datareader-associated-with-this-connectio var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() orderby x.Timestamp descending select new { x.Key, x.connectStart, x.connectEnd, x.Timestamp }; //var f = q.FirstOrDefaultAsync().Result; var f = q.FirstOrDefault(); Console.WriteLine(new { f }); //new PerformanceResourceTimingData2ApplicationPerformance().Where(x => x.Key == f.Key).Delete(); //new PerformanceResourceTimingData2ApplicationPerformance().Delete(x => x.Key == f.Key); new PerformanceResourceTimingData2ApplicationPerformance().Delete(f.Key); mysqldp.CloseMainWindow(); Debugger.Break(); }
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201510/20151006/xlsx // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150911/mysql //Implementation not found for type import : //type: System.Data.SQLite.SQLiteCommand //method: Void .ctor(System.String, System.Data.SQLite.SQLiteConnection) //Did you forget to add the [Script] attribute? //Please double check the signature! //assembly: W:\XSLXAssetWithXElement.ApplicationWebService.exe //type: XSLXAssetWithXElement.Data.Book1+Sheet1+Queries, XSLXAssetWithXElement.ApplicationWebService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null //offset: 0x0006 // method:System.Threading.Tasks.Task Create(System.Data.SQLite.SQLiteConnection) static ApplicationWebService() { // ex = {"Could not load file or assembly 'ScriptCoreLib.Ultra, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"ScriptCoreLib.Ultra, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null"} //{ var r = typeof(ScriptCoreLib.Shared.Data.Diagnostics.WithConnectionLambda); } { var r = typeof(System.Data.SQLite.SQLiteConnection); } { var r = typeof(ScriptCoreLib.Library.StringConversions); } #if DEBUG #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { // jsc should imply it? var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { // "Z:\jsc.svn\examples\javascript\appengine\XSLXAssetWithXElement\XSLXAssetWithXElement\bin\Debug\staging\XSLXAssetWithXElement.ApplicationWebService\staging.net.debug\Book1.xlsx.sqlite" DataSource = "file:Book1.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion #else #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { Console.WriteLine("enter WithConnection"); //var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { //Database = UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { //var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? //var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); var QDataSource = "XSLXAssetWithXElement"; // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); // jsc java does the wrong thing here cc0.Close(); //cc0.Dispose(); Console.WriteLine("exit WithConnection"); }; #endregion #endif }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs #region MySQLConnection // the idea is to test MySQL as we have LINQ to SQL also running in chrome now var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(5500); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. var st = Stopwatch.StartNew(); while (true) { try { Thread.Sleep(300); cc0.Open(); break; } catch { if (st.ElapsedMilliseconds > 6000) { // give up throw; } } } #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion new PerformanceResourceTimingData2ApplicationPerformance().Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, Tag = "first insert" } ); new PerformanceResourceTimingData2ApplicationResourcePerformance().Insert( new PerformanceResourceTimingData2ApplicationResourcePerformanceRow { connectStart = 5, Tag = "first insert" } ); // Additional information: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== `y`.`connectStart` var q = ( from x in new PerformanceResourceTimingData2ApplicationPerformance() join y in new PerformanceResourceTimingData2ApplicationResourcePerformance() on x.connectStart equals y.connectStart select new { field1 = x.connectStart, field2 = y.connectStart, field3 = y.connectStart, } ); var f = q.FirstOrDefault(); Console.WriteLine(new { f }); // { f = { field1 = 5, field2 = 5, field3 = 5 } } mysqldp.CloseMainWindow(); Debugger.Break(); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs #region MySQLConnection // the idea is to test MySQL as we have LINQ to SQL also running in chrome now var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(5500); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. var st = Stopwatch.StartNew(); while (true) try { Thread.Sleep(300); cc0.Open(); break; } catch { if (st.ElapsedMilliseconds > 6000) // give up throw; } #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion new PerformanceResourceTimingData2ApplicationPerformance().Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, Tag = "first insert" } ); new PerformanceResourceTimingData2ApplicationResourcePerformance().Insert( new PerformanceResourceTimingData2ApplicationResourcePerformanceRow { connectStart = 5, Tag = "first insert" } ); // Additional information: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== `y`.`connectStart` var q = ( from x in new PerformanceResourceTimingData2ApplicationPerformance() join y in new PerformanceResourceTimingData2ApplicationResourcePerformance() on x.connectStart equals y.connectStart select new { field1 = x.connectStart, field2 = y.connectStart, field3 = y.connectStart, } ); var f = q.FirstOrDefault(); Console.WriteLine(new { f }); // { f = { field1 = 5, field2 = 5, field3 = 5 } } mysqldp.CloseMainWindow(); Debugger.Break(); }