c# - while updating grid view not updating all table -
After
I am working on windows from application..i am filling my data grid view like this:
SqlCommandBuilder = new SqlCommandBuilder (adapters) as as an adapter = new SqlDataAdapter ( "c.cid, c.CompanyName, l.LocName location, department called Deeditiaidi, Dkdtn, Deeditifon phone As d.dtEmail Email, join the CompanyMaster_tbl from l.Locid c DepartmentMaster_tbl d c.Cid = d.cId to join the location_tbl L at l.Locid = c.locid where d.Deleted = 0 and c. Deleted = 0 Order Cia D. ", con.connect) dt1 = new Detatabl bSource = new binding Associate Adaptrkfil (DT-1) dB Bisoarskdetasors = DT 1 Jivikdetasors = Bisoars GV. Fill DT with information from the column ("CID"). Visual = False gv.Columns ("dtId") Viewable = false gv.Columns ("Locid") Viewable = falseupdate button I have code like this: ..
adapter = new Skyueldataadaptr () Dijib CID integer integer as dim Ditiaidi as string dim Ditianan as dim cmpname String em dtphone string slow dtEmail string slow LOCNAME string dim locid integer For as far as I want to form an integer = 0 to gv.RowCount - 2 dim RV = DirectCast (gv.Rows (i) .DataBoundItem, DataRowView) CID = Rv.Row.Field (integer) ("Cid") dtid = rv.Row.Field (integer) ("dtId") cmpname = rv.Row.Field (string of) ("CompanyName") LOCNAME = rv.Row. Field of (string of) ("location") dtname = rv.Row.Field (string) (of "department") dtPhone = rv.Row.Field (of string) ("phone") dtEmail = rv.Row.Field ("Email") of Locid = rv.Row.Field (of integer) ("locid") adapter.UpdateCommand = new SqlCommand ("UPDATE CompanyMaster_tbl SET CompanyName = @Compa nyName ", con.connect) adapter.UpdateCommand = New SqlCommand (" Update Location_tbl Set LocName = @ LocName where Locid = @ Locid ", con.connect) adapter.UpdateCommand = New SqlCommand (" Update Vibagmstr_tibl set Ditian Name = @ Ditiannam, Ditifon = @ Ditifon, Ditimel = @ Ditiimel where Ditiaidi = @ Ditiaidi "Con .connect) adapter.UpdateCommand.Parameters.AddWithValue (" @ cid ", cid) adapter.UpdateCommand.Parameters AddWithValue (" @ CompanyName " , cmpname) adapter.UpdateCommand.Parameters.AddWithValue ( "@ LocName", Loknam) adapter.UpdateCommand.Parameters.AddWithValue ( "@ dtId", dtid) adapter.UpdateCommand.Parameters.AddWithValue ( "@ dtName", dtname) adapter. UpdateCommand.Parameters.AddWithValue ("@dtPhone", dtPhone) adapter.UpdateCommand.Parameters.AddWithV alue ( "@ dtEmail", dtEmail) adapter.UpdateCommand.Parameters.AddWithValue ( "@ Locid", Locid) I update adapter .UpdateCommand.ExecuteNonQuery () Next
While a button Also error..i can not be updated to my departmentMaster_tbl..but that is not updating my Location_tbl..what is clicking on is wrong with my code .. Any help is very appreciable .. Thanks
ExecuteNonQuery which will use the current UpdateCommand if you are overwriting your UpdateCommands Available (final) in this case
Comments
Post a Comment