locked
Dynamic SQL generation is not supported against multiple base tables. RRS feed

  • Question

  • I have Joined two tables into a datagridview and i want users to be able to update the table values but i have this error,which is the title of this thread.Is there any alternatives of updating a joined table in datagrid view? here are my codes

     

    Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
        con.Close()
        Dim cmd1 As OleDbCommand = New OleDbCommand("SELECT LECT_NAME,LECT_ADDRESS,LECT_CONTACT,SUB_SEMESTER,SUB_ID,SUB_NAME FROM LECTURE_DETAIL,SUB_DETAIL where LECTURE_DETAIL.LECT_ID = '" & cmd_lecID.Text & "' and SUB_DETAIL.LECT_ID = '" & cmd_lecID.Text & "'", con)
        myDA = New OleDbDataAdapter(cmd1)
        
        myDataSet = New DataSet()
    
        myDA.Fill(myDataSet, "MyTable")
    
        DataGridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
    
        con.Close()
        Dim builder As OleDbCommandBuilder = New OleDbCommandBuilder(myDA)
        myDataSet = New DataSet()
        myDA.Fill(myDataSet, "MyTable")
        DataGridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
    
      End Sub
    Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
        Me.Validate()
        Me.myDA.Update(Me.myDataSet.Tables("MyTable"))
        Me.myDataSet.AcceptChanges()
    
      End Sub

    Friday, April 23, 2010 6:20 AM

Answers

All replies