int queryOk;
//---------- ติดต่อฐานข้อมูล ------------------
conDB conDB01 = new conDB();
string conStr = conDB01.getConStr();
SqlConnection conn = new SqlConnection(conStr);
conn.Open();
SqlCommand cmd = new SqlCommand("dbo.SP_updateInformationByshopID", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@inShopID", SqlDbType.VarChar).Value = lb_shopID.Text;
cmd.Parameters.Add("@inShopName", SqlDbType.NVarChar).Value = txt_shopName.Text;
cmd.Parameters.Add("@inContact", SqlDbType.NVarChar).Value = txt_contract.Text;
cmd.Parameters.Add("@inHomeNumber", SqlDbType.VarChar).Value = txt_number.Text;
cmd.Parameters.Add("@inMoo", SqlDbType.Int).Value = int.Parse(txt_moo.Text);
cmd.Parameters.Add("@inRoad", SqlDbType.NVarChar).Value = txt_road.Text;
cmd.Parameters.Add("@inTumbon", SqlDbType.NVarChar).Value = txt_tumbon.Text;
cmd.Parameters.Add("@inAmper", SqlDbType.NVarChar).Value = txt_amper.Text;
cmd.Parameters.Add("@inProvince", SqlDbType.NVarChar).Value = txt_province;
cmd.Parameters.Add("@inPostCode", SqlDbType.Int).Value = int.Parse(txt_zipCode.Text);
cmd.Parameters.Add("@inPhone", SqlDbType.NVarChar).Value = txt_phone.Text;
cmd.Parameters.Add("@inMobile", SqlDbType.NVarChar).Value = txt_mobile.Text;
cmd.Parameters.Add("@inLat", SqlDbType.NVarChar).Value = txt_lat.Text;
cmd.Parameters.Add("@inLong", SqlDbType.NVarChar).Value = txt_long.Text;
cmd.Parameters.Add("@inShopType", SqlDbType.VarChar).Value = txt_shopType.Text;
cmd.Parameters.Add("@inShopRate", SqlDbType.Int).Value = int.Parse(txt_rank.Text);
cmd.Parameters.Add("@inDept", SqlDbType.VarChar).Value = txt_dept.Text;
cmd.Parameters.Add("@inUnit", SqlDbType.NVarChar).Value = txt_unit.Text;
cmd.Parameters.Add("@inNote", SqlDbType.NVarChar).Value = txt_note.Text;
cmd.Parameters.Add("@inVisitDate", SqlDbType.Date).Value = lb_visitDate.Text;
cmd.Parameters.Add("@inDayTrip", SqlDbType.Int).Value = int.Parse(txt_dayTrip.Text);
queryOk = cmd.ExecuteNonQuery();
conn.Close();
if (queryOk == 1) //ตรวจสอบผลการ query
{
MessageBox.Show("อัพเดตข้อมูลเสร็จเรียบร้อย");
this.Close();
}
else
{
MessageBox.Show("การอัพเดตเกิดความผิดพลาด");
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น