Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by Robby
Some people are wise and some are other-wise.
  • Moderators
Posted
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.
Visit...Bassic Software
Posted

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

Some people are wise and some are other-wise.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...