Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database not updating!
Message
 
To
23/11/2002 19:36:13
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00726205
Message ID:
00726294
Views:
22
Hi Bonnie,
Yes I am using CommandBuilder, below is my related code in brief:

' Initiolize ....
Dim mySql = "SELECT * FROM AN_Bank"
Dim myDA As New SqlDataAdapter(mySql, myConn.oConnection)
Dim myCB As New SqlCommandBuilder(myDA)

Dim myDS As New DataSet()
Dim myDR As DataRow

Private Sub frm_Bank_Load
myDA.UpdateCommand = myCB.GetUpdateCommand
myDA.Fill(myDS, "Bank")

' Fill the DataRow
myDR = myDS.Tables("Bank").Rows(0)

Call DataBinding()
End Sub

Private Sub DataBinding()
Me.cbSelect.DataSource = myDS.Tables("bank").DefaultView
Me.cbSelect.DisplayMember = "BankName_e"

Me.txtBankName_e.DataBindings.Add("Text", myDS.Tables("Bank").DefaultView, "BankName_e")
Me.txtBankName_a.DataBindings.Add("Text", myDS.Tables("Bank").DefaultView, "BankName_a")
End Sub

Private Sub btnSave_Click
myDR("bankname_a") = "First Bank" ' This as test
myDA.Update(myDS, "Bank")
myDS.AcceptChanges()
End Sub

Thanks again



>Well, you're probably missing a few steps somewhere. Did you use the CommandBuilder to set up your Insert/Update/Delete commands? Why don't you post the code you have for setting up the DataAdapter, etc. and maybe we can see what you're missing.
>
>~~Bonnie
>
>>Hi All,
>>
>>Any boady know what is rong in this simble code, my DataRow and DataSet is update, but Database is not updating.
>>*** Note: I am using Sql - MSDE
>>
>>myDR("bankname_a") = "US First Bank"
>>myDA.Update(myDS, "Bank")
>>myDS.AcceptChanges()
>>
>>Thanks in advance
<><><><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><><><>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform