public static void Test1_Delete() { ConnectionConfig config = new ConnectionConfig("localhost", "root", "root"); config.database = "test"; MySqlConnection sqlConn = new MySqlConnection(config.host, config.user, config.password, config.database); sqlConn.UseConnectionPool = true; sqlConn.InternalOpen(); string sql = "select * from ??t1 where ??c1 > ?n1 and ??c1 < ?n2"; int testN1 = 4510; int testN2 = 4520; MySqlCommand command = new MySqlCommand(sql, sqlConn); command.Parameters.SetSqlPart("??t1", "saveimage"); command.Parameters.SetSqlPart("??c1", "idsaveImage"); command.Parameters.AddWithValue("?n1", testN1); command.Parameters.AddWithValue("?n2", testN2); sqlConn.InternalClose(); }
public static void Test1_Insert() { //string filename = "TestMe.png";//216,362 bytes byte[] buffer = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; ConnectionConfig config = new ConnectionConfig("localhost", "root", "root"); config.database = "test"; MySqlConnection sqlConn = new MySqlConnection(config.host, config.user, config.password, config.database); sqlConn.UseConnectionPool = true; sqlConn.InternalOpen(); string sql = "INSERT INTO ??t1 SET ??c2 = ?buffer1"; MySqlCommand command = new MySqlCommand(sql, sqlConn); command.Parameters.SetSqlPart("??t1", "saveimage"); command.Parameters.SetSqlPart("??c2", "saveImagecol"); command.Parameters.AddWithValue("?buffer1", buffer); command.ExecuteNonQuery(); sqlConn.InternalClose(); }