Re: SQL Adapter will NOT update

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

OnLoad event of the pages fires each time when you do postback. In your case
if button causes postback, then page will be reloaded. What you could do to
check Page.IsPostBack property in this event. If this is True, then do not
load data again from the database

--
Val Mazur
Microsoft MVP

http://xport.mvps.org



"Steve Newbie" <SteveNewbie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E2CB827C-03C6-4E47-9940-E4D6388B008B@xxxxxxxxxxxxxxxx
>I think it might be something else... when you program a button to do this
> operation in .aspx, (update the database) does the page reload? If so,
> how
> do you specify for the page not to reload. I think it might be some of
> the
> code that is in the Page_Onload Sub, otherwise, i agree, update should be
> working in this case, (that's what the book says..)
>
> thanks!!
>
> "Val Mazur (MVP)" wrote:
>
>> Hi,
>>
>> Are you sure that strCaseNotes variable does not contain exact same value
>> as
>> in original value of the DataColumn. This is the only explanation I see
>> to
>> this. Update works pretty good and I do not see any reason that it should
>> not work in your case
>>
>> --
>> Val Mazur
>> Microsoft MVP
>>
>> http://xport.mvps.org
>>
>>
>>
>> "Steve Newbie" <SteveNewbie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:A6A293EE-7F58-4A04-92F2-00F7C67454BC@xxxxxxxxxxxxxxxx
>> > Please HELP! I am a total beginner. I have a web application that
>> > queries
>> > a
>> > sql database and then returns only on row to a dataset. This row is
>> > then
>> > manipulated for an indeterminate amount of time. (this is a work order
>> > app)
>> > so I chose to use the dataset to accomplish this. Problem is that when
>> > i
>> > call sqldataadapter.update(MyDataSet) it will only update if i pass it
>> > explixit strings, that is to say:
>> >
>> > sqlconnection1.open()
>> > dim strCaseNotes as string = txtbox1.text.tostring()
>> > MyDataSet.Tables(0).Rows(0).Items(7) = strCaseNotes
>> > sqldataadapter1.update(myDataSource)
>> > sqlconnection1.close()
>> >
>> > does not work. in line 3, if i specify ...Items(7) = "Specific
>> > String"
>> > then the data updates... if not, the data stays the same..
>> >
>> > i will provide all the source if needed PLEASE HELP!!!!!!
>> >
>>
>>
>>


.


Quantcast