problem with update in dataset

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2006
Posts: 14
Reputation: lukis is an unknown quantity at this point 
Solved Threads: 0
lukis lukis is offline Offline
Newbie Poster

problem with update in dataset

 
0
  #1
May 15th, 2007
Hi there,

i'm working on a project in which i'm creating, editing and deleting customer records from a MS access db. I'm using vb.net 2003.

As with creating and deleting records i dont have any probelms. the problems arise when i come to update the data base if i edit any details. when i debugged it it showed the changes but not in the database. below is the code i used :

PrivateSub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
MsgBox("Do you want to save to database?", MsgBoxStyle.YesNo)
If MsgBoxResult.Yes Then
 
Dim custrow As DataSet1.CustomerRow
custrow = DataSet11.Customer.FindByCust_id(lblCustNo.Text)
custrow.BeginEdit()
custrow.Cust_Address = txtAdd.Text
custrow.Cust_email = txtEmail.Text
'custrow.Cust_id = lblCustNo.Text
custrow.Cust_name = txtName.Text
custrow.Cust_Sname = txtSname.Text
custrow.Cust_Tel = txtTel.Text
custrow.EndEdit()
custrow.AcceptChanges()
Me.oledb_cust_edit.Update(Me.DataSet11)
Me.OleDbConnection1.Close()
End If
Me.oledb_cust_edit.Fill(DataSet11)
interfaces.form2.Show()
interfaces.form4.Hide()
End Sub


it's not giving me any errors. any help please very much appreciated

thank you very much

Luke
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: problem with update in dataset

 
0
  #2
May 15th, 2007
I am not a database person but I have heard that if you run your program in the IDE then a new database is created each time the program is run. Try compiling and running the bin/release/ exe.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 122
Reputation: manal is an unknown quantity at this point 
Solved Threads: 17
manal's Avatar
manal manal is offline Offline
Junior Poster

Re: problem with update in dataset

 
0
  #3
May 16th, 2007
custrow.AcceptChanges()
Me.oledb_cust_edit.Update(Me.DataSet11)
here is the problem
after calling AcceptChanges the RowState property of custrow will be set to Unchanged so Me.oledb_cust_edit.Update(Me.DataSet11) will return NO change to the dataset

to solve this just inverse the two lines

  1. Me.oledb_cust_edit.Update(Me.DataSet11)
  2. custrow.AcceptChanges()
Last edited by manal; May 16th, 2007 at 12:29 am.
"give only what u willing to receive "
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC