data binding update problem
-
hi i am using data binding and this is my code
Imports System.Drawing.Printing Public Class Form2 Public ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source =" & Application.StartupPath & "\ITDSS.mdb" Public con As New OleDbConnection(ConStr) Dim DataSet1, course As New DataSet 'Dim SQLstr = "SELECT SectionID,Type,Group,TeacherID from [Section]" Dim SQLstr = "SELECT DISTINCT s.LevelNo, c.CourseID,c.SectionID,c.Type,c.Group, r.RoomID FROM [Section] c,Course s,[Slot] r where s.CourseID=c.CourseID and c.SectionID=r.SectionID ORDER BY s.LevelNo" ' in(select CourseID from Course Where LevelNo=1)" 's,Course c WHERE s.CourseID = c.CourseID ORDER BY c.LevelNo" Dim DataAdapter1 As New OleDb.OleDbDataAdapter(SQLstr, con) '----------------------=============================== Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim SQLstr, SQLstr1 As String 'Dim DataSet1, course As New DataSet 'SQLstr = "SELECT SectionID,Type,Group from [Section]" Con.Open() 'DataAdapter1 = New OleDb.OleDbDataAdapter(SQLstr, con) DataAdapter1.Fill(DataSet1, "Section") Me.DataBindings.Add("text", DataSet1, "Section.SectionID") DataGridView1.DataSource = DataSet1 DataGridView1.DataMember = "Section" Dim bmb As BindingManagerBase bmb = Me.BindingContext(DataSet1, "Section") bmb.Position = bmb.Count bmb.Position = 0 end sub
and i want to update it when button press i but the flowing codePrivate Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim CmdB As New OleDb.OleDbCommandBuilder(DataAdapter1) DataAdapter1.Update(DataSet1, "Section") End Sub End Class
but it give error update statement please i need help :(( :zzz: -
hi i am using data binding and this is my code
Imports System.Drawing.Printing Public Class Form2 Public ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source =" & Application.StartupPath & "\ITDSS.mdb" Public con As New OleDbConnection(ConStr) Dim DataSet1, course As New DataSet 'Dim SQLstr = "SELECT SectionID,Type,Group,TeacherID from [Section]" Dim SQLstr = "SELECT DISTINCT s.LevelNo, c.CourseID,c.SectionID,c.Type,c.Group, r.RoomID FROM [Section] c,Course s,[Slot] r where s.CourseID=c.CourseID and c.SectionID=r.SectionID ORDER BY s.LevelNo" ' in(select CourseID from Course Where LevelNo=1)" 's,Course c WHERE s.CourseID = c.CourseID ORDER BY c.LevelNo" Dim DataAdapter1 As New OleDb.OleDbDataAdapter(SQLstr, con) '----------------------=============================== Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim SQLstr, SQLstr1 As String 'Dim DataSet1, course As New DataSet 'SQLstr = "SELECT SectionID,Type,Group from [Section]" Con.Open() 'DataAdapter1 = New OleDb.OleDbDataAdapter(SQLstr, con) DataAdapter1.Fill(DataSet1, "Section") Me.DataBindings.Add("text", DataSet1, "Section.SectionID") DataGridView1.DataSource = DataSet1 DataGridView1.DataMember = "Section" Dim bmb As BindingManagerBase bmb = Me.BindingContext(DataSet1, "Section") bmb.Position = bmb.Count bmb.Position = 0 end sub
and i want to update it when button press i but the flowing codePrivate Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim CmdB As New OleDb.OleDbCommandBuilder(DataAdapter1) DataAdapter1.Update(DataSet1, "Section") End Sub End Class
but it give error update statement please i need help :(( :zzz:Um where is your update script!, I can see your select but no update
Never underestimate the power of human stupidity RAH