>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only