Hi,
When I try to update the database table from the dataset table after inserting a new row in the datasets datatable I get the following error
------------------------------------------
An unhandled exception of type System.InvalidOperationException occurred in system.data.dll
Additional information: The DataAdapter.SelectCommand property needs to be initialized.
------------------------------------------
at the line
"adpProject.Update(dsProj, "Tasks")"
But I have initialised the dataadapters selectcommand property.
cnPMS.Open()
Create a SqlDataAdapter for the Project table.
Dim adpProject As SqlDataAdapter = New SqlDataAdapter()
A table mapping tells the adapter what to call the table.
adpProject.TableMappings.Add("Table", "Tasks")
Dim cmdProject As SqlCommand = _
New SqlCommand("SELECT * FROM Tasks", cnPMS)
cmdProject.CommandType = CommandType.Text
adpProject.SelectCommand = cmdProject
adpProject.Fill(ds)
BEGIN SEND CHANGES TO SQL SERVER
Dim objCommandBuilder As New SqlCommandBuilder(adpProject)
adpProject.Update(dsProj, "Tasks")
END SEND CHANGES TO SQL SERVER
Please Help. Thanks.
When I try to update the database table from the dataset table after inserting a new row in the datasets datatable I get the following error
------------------------------------------
An unhandled exception of type System.InvalidOperationException occurred in system.data.dll
Additional information: The DataAdapter.SelectCommand property needs to be initialized.
------------------------------------------
at the line
"adpProject.Update(dsProj, "Tasks")"
But I have initialised the dataadapters selectcommand property.
cnPMS.Open()
Create a SqlDataAdapter for the Project table.
Dim adpProject As SqlDataAdapter = New SqlDataAdapter()
A table mapping tells the adapter what to call the table.
adpProject.TableMappings.Add("Table", "Tasks")
Dim cmdProject As SqlCommand = _
New SqlCommand("SELECT * FROM Tasks", cnPMS)
cmdProject.CommandType = CommandType.Text
adpProject.SelectCommand = cmdProject
adpProject.Fill(ds)
BEGIN SEND CHANGES TO SQL SERVER
Dim objCommandBuilder As New SqlCommandBuilder(adpProject)
adpProject.Update(dsProj, "Tasks")
END SEND CHANGES TO SQL SERVER
Please Help. Thanks.