sizer Posted April 7, 2003 Posted April 7, 2003 (edited) Can anyone help me!!! Here is the code and explanation: When i press button1 (which is Update) my DB should be Updated but that doesn't work.Why?Why? '' dsn=acc is ODBC connection to ACCESS DB Dim con As New ODBC.OdbcConnection("dsn=acc") Dim command As New ODBC.OdbcCommand("SELECT * FROM SERVIS", con) Dim adp As New ODBC.OdbcDataAdapter(command) Dim ds As New DataSet("SERVIS") Dim cmdBuilder As New ODBC.OdbcCommandBuilder(adp) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load adp.Fill(ds, "SERVIS") TextBox1.DataBindings.Add("Text", ds, "SERVIS.Rbr") DataGrid1.DataMember = "SERVIS" DataGrid1.DataSource = ds End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click adp.Update(ds, "SERVIS") ds.AcceptChanges() End Sub Edited April 7, 2003 by Robby Quote Some people are wise and some are other-wise.
Moderators Robby Posted April 7, 2003 Moderators Posted April 7, 2003 Before updating you need to change the DataAdapter's command to an Update statement (not a Select statement). Then use the Update method of the DataAdapter to actually update. Quote Visit...Bassic Software
sizer Posted April 7, 2003 Author Posted April 7, 2003 When I do same thing with DAtaGrid it works fine!! I've declared Command Builder to do UPDATE,INSERT,DELETE command instead ME!! If I'm wrong can you post some example!! Thanks Quote Some people are wise and some are other-wise.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.