Updating SQL server table with vb.net 2010 datagridview -


I have trouble updating my database table with datababridge, I have read some thread about the problem and some Not even my case. Here the code I use is DataGridView populated. public DATE filldatagridserver (as byRef SQL string, byRef DG as DataGridView) MyDataset Dataset = new dataset myAdptr.SelectCommand = new SqlCommand (sql, cnSQL) myAdptr Fill (myDataset) dg.DataSource = myDataset.Tables (0) dg.AutoResizeColumns () myAdptr.Dispose () myDataset.Dispose () cnSQL.Close () End Sub

This sub process with code says:

  call filldatagridserver ("select * from tblQuarterCollection", dg quarter)   

I used already MyAdptr .update but I

table While getting an error about mapping, I tried to settle and also said that in the sub process, to try to quote a lot out but it still does not work. Anyway, fill the DataGridView properly and update the changes made in the database. I think that here my last resort will be looping through each record, data will be updated in the data grid view according to current data. Please help

try this:.

  Private sub-btnAdd_Click (as the object, in the form of e EventArgs) handle btnAdd.Click add new as SqlCommand addcmd ("(insert in tableName value @ col1, @ col2) ", YourConnectionString) addcmd.parameters.addwithvalue (" @ col1 ", txtCol1.text) addcmd. Parameters.addwithvalue ("@ col2", txtCol2.text) addcmd.executiononQuery closing sub    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -