|
|
|
ขอ Code Register (C#+MySQL) หรือเพิ่มข้อมูลใหม่เข้า datebace หน่อยนะครับ ผม |
|
|
|
|
|
|
|
อออกแบบ Form ก่อนน่ะครับ จากนั้นแค่ใช้การ Insert ผ่าน ExecuteNonQuery ครับ
Code (C#)
MySqlConnection objConn = new MySqlConnection();
MySqlCommand objCmd = new MySqlCommand();
String strConnString,strSQL;
strConnString = "Server=localhost;User Id=root; Password=root; Database=mydatabase; Pooling=false";
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " +
" VALUES " +
" ('" + this.txtCustomerID.Text + "','" + this.txtName.Text + "','" + this.txtEmail.Text + "', " +
" '" + this.txtCountryCode.Text + "','" + this.txtBudget.Text + "','" + this.txtUsed.Text + "')";
objConn.ConnectionString = strConnString;
objConn.Open();
objCmd.Connection = objConn;
objCmd.CommandText = strSQL;
objCmd.CommandType = CommandType.Text;
objCmd.ExecuteNonQuery();
objConn.Close();
objConn = null;
|
|
|
|
|
Date :
2012-12-29 06:52:08 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|