The line in red bold is generating the following error - Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Can you please assist? Thanks
Can you please assist? Thanks
VB.NET:
Private Sub SaveData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveData.Click
Dim connstring As String = "Data Source=BM-PC;Initial Catalog=EquinexMasterSql;Integrated Security = True"
Dim sql As String = "select * from TempRatingsData"
Dim conn As SqlConnection = New SqlConnection(connstring)
If (Form1.showndata = 1 And Form1.datedata = 0 And Form1.racedata = 0) Then
conn.Open()
builder.GetUpdateCommand()
da.Update(ds, "TempRatingsData")
da = New SqlDataAdapter(sql, conn)
da.SelectCommand = New SqlCommand(sql, conn)
builder = New SqlCommandBuilder(da)
da.Update(Me.EquinexMasterSqlDataSet, "TempRatingsData")
Me.EquinexMasterSqlDataSet.Clear()
da.Fill(Me.EquinexMasterSqlDataSet, "TempRatingsData")
DataGridView1.DataSource = Me.EquinexMasterSqlDataSet.Tables("TempRatingsData")
'Me.RatingsDataTableAdapter.Update(Me.EquinexMasterSqlDataSet.RatingsData)
Me.TempRatingsDataTableAdapter.Update(Me.EquinexMasterSqlDataSet.TempRatingsData)
conn.Close()
ElseIf (Form1.showndata = 0 And Form1.datedata = 1 And Form1.racedata = 0) Then
conn.Open()
[COLOR="Red"] [B]builder.GetUpdateCommand()[/B] [/COLOR]da.Update(ds, "TempRatingsData")
da = New SqlDataAdapter(sql, conn)
da.SelectCommand = New SqlCommand(sql, conn)
builder = New SqlCommandBuilder(da)
da.Update(Me.EquinexMasterSqlDataSet, "TempRatingsData")
Me.EquinexMasterSqlDataSet.Clear()
da.Fill(Me.EquinexMasterSqlDataSet, "TempRatingsData")
DataGridView1.DataSource = Me.EquinexMasterSqlDataSet.Tables("TempRatingsData")
'Me.RatingsDataTableAdapter.Update(Me.EquinexMasterSqlDataSet.RatingsData)
Me.TempRatingsDataTableAdapter.Update(Me.EquinexMasterSqlDataSet.TempRatingsData)
conn.Close()
ElseIf (Form1.showndata = 0 And Form1.datedata = 0 And Form1.racedata = 1) Then
conn.Open()
builder.GetUpdateCommand()
da = New SqlDataAdapter(sql, conn)
da.SelectCommand = New SqlCommand(sql, conn)
builder = New SqlCommandBuilder(da)
da.Update(Me.EquinexMasterSqlDataSet, "TempRatingsData")
Me.EquinexMasterSqlDataSet.Clear()
da.Fill(Me.EquinexMasterSqlDataSet, "TempRatingsData")
DataGridView1.DataSource = Me.EquinexMasterSqlDataSet.Tables("TempRatingsData")
'Me.RatingsDataTableAdapter.Update(Me.EquinexMasterSqlDataSet.RatingsData)
Me.TempRatingsDataTableAdapter.Update(Me.EquinexMasterSqlDataSet.TempRatingsData)
conn.Close()
End If
End Sub