sql - System.InvalidOperationException: Error on updating the table through datagridview using dt.update method -


I have a problem updating the table through the data grid view with a button click here is my code.

  public sub loaddgvfrm3 () cmdconn = new SqlConnection cmd = new SqlCommand cmdconn.ConnectionString = sqlstr cmdconn.Open () cmd.Connection = cmdconn select cmd.CommandText = "period, VOUCH_AMT, Indivijual_amti , Check_no, d_midadad, dir_no, what updated, tobee.EBD_BILLHISTORY of the year student where CLAIM_NO like "+ + txtClaimno.Text" "CMD" Commandtekst = "a. Period, a. Viaiacmamti, e. Indivijual_amti, select a .check_no, a.bal_ent, a.D_MAILED, a.DIR_NO left one tobee.EBD_BILLHISTORY carlos.claims_waivee b a.CLAIM_NO = b.claim_no where like b.CLAIM_NO 'retarded' '+ claimno.ToString + "'" to "dim cmdbuilder = as new DataTable for DS new SqlCommandBuilder (DA) 'da = new SqlDataAdapter (included) da.SelectCommand = Cmd da.Fill (DT) Me.DataGridView1.DataSource = DT Me.DataGridView2.DataSource = DT cmdconn.Close () last sub  

The above code is the DataGrid visual content where I select my choice Statement. And that's the DataGridView I'm just modifying

  Private sub btnSave_Click (try this item as btnSave.Click handle as batch), cmdbuilder = new SqlCommandBuilder (DA) da.Update (DT) DT .AcceptChanges () Expire MsgBox ("changed" P> Whenever I click save button after modifying a certain row, an error log comes out,  < P> This kind of error look:  

System.InvalidOperationException: Dynamic SQL generation for UpdateCommand does not return any key column that is not supported against a SelectCommand information. System.data.mon.dbdataadapter.updatingrowstatusErrors (System.Data.Common.DbDataAdapter.UpdateFromDataTable) (DataTable dataTable, DataTableMapping tablemapping) on ​​System.data.Comumn.DbDataArrors on System.Data.Common.DataAdapter.Update (DataTable dataTable) (RowUpdatingEventArgs rowUpdatedEvent, DataRow datarow) on .frmEb.btnSave_Click (object sender, EventArgs e) C: \ Users \ fox \ documents \ stress tests \ academic \ form3.vb: line 220

but the program still Continue. I can not see any changes made to DGV in the database. ? Database = testdb; User = bit; Password there is something that i am missing

here is my announcement

  string = "server = midtelephone \ sqlexpress dim as connstr = bit," cmdconn Moderate = New SqlConnection Dim cmdBuilder SqlCommandBuilder Dims New SqlDataAdapter (as) New DataTable  

Before that error, they say I need to set a primary key that is / unique key As the DT was in the dorm in the database, then I did, but the same error came up.

Pls help me, actually stuck in this stage, if you do so, I will always be thankful because it is the final part of my project. Updating updated changes from database to

postprop = "text">

The command builder can only generate one UpdateCommand and a DeleteCommand if: