I have added a grid view control to a windows form. The form is not bound to a datasource.
The form and data grid are updated programattically using SQLAdapter . The following is the main bit of the code that currently gets the data into the grid view.
objDataAdapter.SelectCommand = New SqlCommand
objDataAdapter.SelectCommand.Connection = objCnn
objDataAdapter.SelectCommand.CommandText = strMedicalHistorySQL & "WHERE tblMedical.MEMBER_ID = " & MemberNumber 'SQL string representing required table fields in SQL Server DB"
objDataAdapter.SelectCommand.CommandType = CommandType.Text
'Create the dataset and data views
objMemDS = New DataSet
'Fill the data grid
grdMedicalHistory.AutoGenerateColumns = True
grdMedicalHistory.DataSource = objMemDS
grdMedicalHistory.DataMember = "MedicalHistory"
I want to be able to allow users to add rows to the grid view and edit existing rows but cannot get it to work. My questions are:
1) How do I update the dataset
2) How will the application 'know' whether I am adding a new record (insert) or editing an existing one (update)
3) in one of the grid views I need to implement there will be several tables included in the update.
I am completely lost after hours trying to research this by myself and could really use some help