using MySql.Data;
using MySql.Data.MySqlClient;
using(MySqlConnection Con
= new MySqlConnection("server=yeonpil.org;database=x;user id=x;password=x"))
{
MySqlCommand Cmd = new MySqlCommand();
Cmd.Connection = Con;
if (Con.State == ConnectionState.Closed) {
Con.Open();
}
Cmd.CommandText = "INSERT INTO Table1 (name) values (?name)";
Cmd.Parameters.Add("?name", MySqlDbType.VarChar, 50).Value = nameValue;
// m.Parameters.AddWithValue("@param_val_1", val1);
// m.Parameters.Add(new MySqlParameter("param1", val1));
Cmd.ExecuteNonQuery();
Cmd.Dispose();
}
댓글 없음:
댓글 쓰기