Hi,
My application is in VS2008 coded in VB.Net
I have a DatagridView.I have a Save Button on my Form.Now my requirement is i want to the Data that is populated in Datagridview when i click on Save button.
I want to do it using Update Query.
below is my code.
DgvStudRecord is my DatagridView
I want to update only the Fourth Column in Datagrid.
Sub update()
DBConnect()
con = DBActions.DBConnect
strsql = "Update AdmittedStudents set MobileNo='" DgvStudRecord.Item(4, DgvStudRecord.CurrentCell.RowIndex) "' where RegNo='" & 1 & "'"
cmd = New SqlCommand(strsql, con)
cmd.ExecuteNonQuery()
MessageBox.Show("Record Updated", "Weekly Off", MessageBoxButtons.OK)
End Sub
Im getting an error in the Query as End Of Statement Expected.This is the first time transacting using DatagridView.
Please suggest at the earliest where im wrong.