|
 |
|
มันบอกว่าไม่รู้จัก Involid Object Name 'CommiteeReqKey'. ต้องแก้ไขอย่างไรครับ Edit Code C# |
|
 |
|
|
 |
 |
|
พอผมเรียกข้อมูลจาก datagrid มาแก้ไขพอเปลี่ยนหรือแก้ไขข้อมูลเสร็จกด แก้ไข มันดันขึ้น Involid Object Name 'CommiteeReqKey'.
Code (C#)
private void tsb_EditDis_Click(object sender, EventArgs e)
{
ConnectionStringSettings conSettings = ConfigurationManager.ConnectionStrings["ApplicationDatabase"];
string ConnectionStrings = conSettings.ConnectionString;
try
{
string update;
conn = new SqlConnection(ConnectionStrings);
conn.Open();
update = @"UPDATE CommiteeReqKey SET DocDT = @DocDate,ProjKey = @ProjKey,ProjCode = @ProjCode,ProjAlias = @ProjAlias,ProjName = @ProjName,ContractID = @ContractID,ContractDate = @ContractDate,CustomerKey = @CustomerKey,CustomerName = @CustomerName,ContractAmt = @ContractAmt,ContractVat = @ContractVat,ContractTax = @ContractTax,ContractTaxPercent = @ContractTaxPer,ReqNote = @ReqNote,ReqValue = @ReqVal,ReqValuePercent = @ReqValPer,NetReqValue = @NetReqVal,DiscNote = @DiscNote,DiscValue = @DiscVal,NetTotal = @NetTotal,Note = @Note WHERE CommiteeReqKey = @CommiteeReqKey";
SqlCommand cmd = new SqlCommand(update, conn);
cmd.Parameters.AddWithValue("DocDate",txt_DocDate.Text);
cmd.Parameters.AddWithValue("ProjKey",txt_ProjKey.Text);
cmd.Parameters.AddWithValue("ProjCode",txt_ProjCode.Text);
cmd.Parameters.AddWithValue("ProjAlias",txt_ProjAlias.Text);
cmd.Parameters.AddWithValue("ProjName",txt_ProjName.Text);
cmd.Parameters.AddWithValue("ContractID",txt_ContractID.Text);
cmd.Parameters.AddWithValue("ContractDate",txt_ContractDate.Text);
cmd.Parameters.AddWithValue("CustomerKey",txt_CustomerKey.Text);
cmd.Parameters.AddWithValue("CustomerName",txt_CustomerName.Text);
cmd.Parameters.AddWithValue("ContractAmt",txt_ContractAmt.Text);
cmd.Parameters.AddWithValue("ContractVat",txt_ContractVat.Text);
cmd.Parameters.AddWithValue("ContractTax", txt_ContractTax.Text);
cmd.Parameters.AddWithValue("ContractTaxPer", txt_ContractTaxPer.Text);
cmd.Parameters.AddWithValue("ReqNote",txt_ReqNote.Text );
cmd.Parameters.AddWithValue("ReqVal",txt_ReqVal.Text );
cmd.Parameters.AddWithValue("ReqValPer",txt_ReqValPer.Text );
cmd.Parameters.AddWithValue("NetReqVal",txt_NetReqVal.Text );
cmd.Parameters.AddWithValue("DiscNote",txt_DiscNote.Text );
cmd.Parameters.AddWithValue("DiscVal",txt_DiscValue.Text );
cmd.Parameters.AddWithValue("NetTotal",txt_NetTotal.Text );
cmd.Parameters.AddWithValue("Note",txt_Note.Text );
cmd.Parameters.AddWithValue("CommiteeReqKey",txt_CommitReqKey.Text );
int x = cmd.ExecuteNonQuery();
if (x == 1)
{
MessageBox.Show("ปรับปรุงข้อมูลใช่หรือไม่","ยืนยันการแก้ไขข้อมูล",MessageBoxButtons.OK);
}
ClearForm();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
Datagridview_DGV_Dis();
}
มีวิธีแก้ไขอย่างไรบ้างครับ แนะนำที
Tag : .NET, Ms SQL Server 2008, Win (Windows App), C#

|
|
 |
 |
 |
 |
Date :
2012-09-06 14:29:47 |
By :
Littlefatboyz |
View :
1069 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันไม่รู้จัก table : CommiteeReqKey ครับ
|
 |
 |
 |
 |
Date :
2012-09-06 16:22:38 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ พี่วิน ได้แล้วครับ 
|
 |
 |
 |
 |
Date :
2012-09-06 16:53:09 |
By :
Littlefatboyz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|