Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rowstate for changed rows?
Message
From
15/02/2002 15:47:15
Alex Zhadanov
Computer Generated Solutions
New York City, New York, United States
 
 
To
15/02/2002 14:39:53
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00620834
Message ID:
00620878
Views:
13
>Should I use rowstate to check for modified rows? It seems to show modified whether there are changes or not. See example code below...
>
>Dim userid, password, servername, databasename, connectionstring As String
>Dim con As SqlClient.SqlConnection
>
>userid = "xxx"
>password = "xxx"
>servername = "xxx"
>databasename = "xxx"
>
>connectionstring = "UID=" & userid & ";" & _
> "PWD=" & password & ";" & _
> "Data Source=" & servername & ";" & _
> "Initial Catalog=" & databasename & ";"
>
>con = New SqlClient.SqlConnection()
>con.ConnectionString = connectionstring
>
>Dim tablename, keyname, strSelectedId As String
>Dim strSelect As String
>Dim selectcommand As SqlClient.SqlCommand
>Dim DS As DataSet
>Dim DT As DataTable
>Dim DA As SqlClient.SqlDataAdapter
>
>strSelectedId = "0000000007"
>tablename = "CALLTYPE"
>keyname = "ct_ctid"
>
>strSelect = "Select * from " & tablename & _
> " where " & keyname & "='" & strSelectedId & "'"
>selectcommand = New SqlClient.SqlCommand(strSelect, con)
>
>DA = New SqlClient.SqlDataAdapter(strSelect, con)
>DA.SelectCommand = selectcommand
>DA.SelectCommand.Connection = con
>DS = New DataSet()
>DA.Fill(DS, tablename)
>
>
>MsgBox(DS.Tables("Calltype").Rows(0).ItemArray(0)) ' show initial value
>DS.Tables("Calltype").Rows(0).BeginEdit() ' begin edit
>MsgBox(DS.Tables("Calltype").Rows(0).RowState.ToString) ' state is unchhanged
>DS.Tables("Calltype").Rows(0).EndEdit() ' end edit
>MsgBox(DS.Tables("Calltype").Rows(0).RowState.ToString) ' state is modified???
>
>How do I check for changes if they try to exit without saving?
>
>Kathy

Hi,Kathy.
I think you can use GetChanges method of DataTable.This method returns datatable with only changed rows.
Alex
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform