//*********************************************************************************** static public void MYSQL_MAKE_QUERY() { using (XwDbCommand sql = new XwDbCommand("DBCONN_MYTEST")) { sql.Make(MakeType.UPSERT, "Tester"); sql.AddParameter("ID", 12); sql.AddParameter("@Name", "POIS"); sql.ExecuteMK(); Console.WriteLine(sql.GetDebugCommand()); } }
//*********************************************************************************** static public void MYSQL_FORMAT_QUERY() { using (XwDbCommand sql = new XwDbCommand("DBCONN_MYTEST")) { sql.AddParameter("@Name", "%A%"); sql.ExecuteTX("SELECT * FROM Tester WHERE Name LIKE @Name"); Console.WriteLine(sql.GetDebugCommand()); while (sql.Read()) { Console.WriteLine(sql.Value("Name").ToString()); } } }
//*********************************************************************************** static public void MYSQL_SP_DATAREADER() { using (XwDbCommand sql = new XwDbCommand("DBCONN_MYTEST")) { sql.Mode = XwDbMode.DataReader; sql.AddParameter("$Name", "%C%"); sql.ExecuteSP("TestSP"); Console.WriteLine(sql.GetDebugCommand()); while (sql.Read()) { Console.WriteLine(sql.Value("Name").ToString()); } } }
//*********************************************************************************** static public void MYSQL_MANY_CONNS() { for (int i = 0; i < 20; i++) { using (XwDbCommand sql = new XwDbCommand("DBCONN_MYTEST")) { sql.Mode = XwDbMode.DataReader; sql.AddParameter("$Name", "%C%"); sql.ExecuteSP("TestSP"); Console.WriteLine(sql.GetDebugCommand()); while (sql.Read()) { } } } }
//*********************************************************************************** static public void MSSQL_SP_DATASET() { using (XwDbCommand sql = new XwDbCommand("DBCONN_MSTEST")) { sql.Mode = XwDbMode.DataSet; sql.AddParameter("@Name", "%C%"); sql.ExecuteSP("TestSP"); Console.WriteLine(sql.GetDebugCommand()); if (sql.ReturnedData) { Console.WriteLine($"CNT: {sql.RowCount}"); while (sql.Read()) { Console.WriteLine(sql.Value("Name").ToString()); } } } }