Exemple #1
0
 //***********************************************************************************
 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());
     }
 }
Exemple #2
0
 //***********************************************************************************
 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());
         }
     }
 }
Exemple #3
0
 //***********************************************************************************
 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());
         }
     }
 }
Exemple #4
0
 //***********************************************************************************
 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())
             {
             }
         }
     }
 }
Exemple #5
0
 //***********************************************************************************
 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());
             }
         }
     }
 }