Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database not updating!
Message
From
25/11/2002 15:53:52
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00726205
Message ID:
00726640
Views:
20
Ahmad,

I'm sorry ... I'm out of ideas. Have you been able to get table updating working with *anything* or are you having problems with one specific table?

~~Bonnie

>I did what you said, but still the same problem.
>
>Even I check the Sql database rights for update, everything is ok.!!!!!!!!!!:(
>Any ieda what else could be the problem?
>
>
>>Ahmad,
>>
>>Well, your code looks ok from what I can see. Creating the DataAdapter as you did *should* set the myDA.SelectCommand to be your SELECT statement, but maybe there's a quirk somewhere and it's not setting it as it should (that would cause the CommandBuilder to not create it's Update command perhaps). I'm guessing ... as I said, it *looks* ok, but try this on for size (just to humor me <g>)
>>
>>
>>    Dim mySql = "SELECT * FROM AN_Bank"
>>    Dim myDA As New SqlDataAdapter()
>>    myDA.SelectCommand = New SqlCommand(mySql, myConn.oConnection)
>>
>>'and the rest as you had it ...
>>
>>
>>~~Bonnie
>>
>>>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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform