473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

I lost the state of myDataSet.HasChanges between diferents events

Hi, I use ASP.NET and my problem is I´ve two buttons, a dataSet, a
dataGrid and a sqlDataAdpater, I use
sqlDataAdapter.fill(dataSet,"dbTable"), then when when the user press
the first button, I add a row to a dataSet, but not to the dataBase.
This is my code:

Public Sub Button1_Click(byBal sender As System.Object, byVal e As
System.EventArgs) Handles Button1.Click
dim myRow as dataRow

myRow = dataSet.Tables("dbTable").newRow
myRow("id")=1
myRow("description")="Trade Company"
dataSet.Tables ("dbTable").Rows.Add(myRow)
dataGrid.dataBind()

End Sub

Public Sub Button2_Click(byBal sender As System.Object, byVal e As
System.EventArgs) Handles Button2.Click
dim xDataSet As dataSet
dim myRow as dataRow

If dataSet.HasChanges Then
xDataSet = dataSet.getChanges(DataRowState.Added)
xDataSet.Tables("dbTable").newRow()

for each myRow in xDataSet.tables("dbTable").Rows
'Here I call a Store Procedure with sqlDataReader and saved the
register in dataBase's Table

next
End If
End Sub

Then, when the user press button1; after add the row the
dataSetdataSet.HasChanges = TRUE , then the user press the Button2 and
the datataSet.HasChanges =FALSE,so the dataSet lost its state, I think
it happens when the WebForm return to the user...
In fact, I need put the button2's code in another webForm....

Thanks!!!!
Evelin

Sorry, but I don´t speak english very well as you saw....

Nov 19 '05 #1
0 898

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: raulgz | last post by:
Hi: I have two diferents hosts with sql server 2000: server1, server2 with two diferents bbdd database1, database2 with two diferents schemas owner1,owner2 with the same set of tables...
4
by: thead01 | last post by:
I create a dataset, load xmlfile, create dataview (ds.defaultview) and bind it to a datagrid (dataset haschanges property is now 'true'). When a user closes the form I want to check via...
3
by: Sty | last post by:
Hi, I have a webapplication, which shows images in directories. There are different sub directories and you can change the directory by a pull down list. If I change the name of a directory, the...
6
by: Jason | last post by:
Is it possible to store an entire datatable/dataset in session state? If so, could someone please provide a code snippet or a link to documentation for me please? (I'm having no luck at all) ...
0
by: Czar Eclarinal | last post by:
Hi Everyone, I've declared a datatable out of my typed dataset stored in session and add a new row to it. When state management is set to InProc and I modified the declared dataable, the changes...
9
by: AndersBj | last post by:
Hi all, I have a web application that uses State Server for session handling. The web application randomly loses all session variables. The sessions are not always lost, sometimes I can use the...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
3
by: =?Utf-8?B?dmluY2VudHc1Ng==?= | last post by:
I have an ASP.NET 2.0 application. It is pretty basic. What it does is shows a gridview of data from a stored procedure. The user can also select a date filter. The problem is that sometimes an...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a web application vs2005 and it looks like a condition is causing session veriables to be lost. This does not seem to be happening too often. The web application allows uploading and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.