Hi,
I am hoping someone could give me a clue...
I am working with VB.NET and have done the following...
------------------For the form declarations-----------------
Public sConnection = <<DECLARED PROPERLY>>
Friend SqlConnection As System.Data.SqlClient.SqlConnection
Friend sqlAdapter As System.Data.SqlClient.SqlDataAdapter
Friend sqlCmd As System.Data.SqlClient.SqlCommand
Friend dsInfo
Friend sqlCmdBuilder As System.Data.SqlClient.SqlCommandBuilder
------------------------the Load event--------------------
SqlConnection = New SqlConnection(sConnection)
sqlCmd = New SqlCommand("SELECT PeopleID, Directory, PublishIt, FirstName, LastName, Address1, Address2, Address3, Zip, City, State, Country, Phone, Fax, Website, Email, DatelastModified from tPeople", SqlConnection)
sqlAdapter = New SqlDataAdapter(sqlCmd)
sqlCmdBuilder = New SqlCommandBuilder(sqlAdapter)
dsInfo = New DataSet
SqlConnection.Open()
sqlCmd.CommandText = "SELECT PeopleID, Directory, PublishIt, FirstName, LastName, Address1, Address2, Address3, Zip, City, State, Country, Phone, Fax, Website, Email, DatelastModified from tPeople"
sqlAdapter.Fill(dsInfo, "Services")
-----------------the button click-------------------
dsInfo.Tables("services").Rows(0).BeginEdit()
dsInfo.Tables("Services").Rows(0).Item("Address1") = "1111"
dsInfo.Tables("services").Rows(0).EndEdit()
dsInfo.Tables("services").Rows(0).AcceptChanges()
sqlAdapter.Update(dsInfo, "Services")
dsInfo.AcceptChanges()
----------------comments----------------------------
I put a break on the AcceptChanges line to see the RowState for that particular row and it is classified as "unchanged"
Even though the Row shows the new value and once the click code is finished the *text box* on the *form* for address1 does get updated to that value.
It won't save to the database either.
Other case is if I type something in a text box itself (instead of using code behind) it does the same thing. the Row adn field itself reflects the changes. However, the row state is classified as "unchanged" and it won't save to the database.
So whether I use a form to put in the value to the dataset or use code behind and do it by hand, I am not getting it to work.
What am I doing wrong? I know I must be missing something.. Either that or the gremlins got my computer
Any help is greatly appreciated!
Angela
I am hoping someone could give me a clue...
I am working with VB.NET and have done the following...
------------------For the form declarations-----------------
Public sConnection = <<DECLARED PROPERLY>>
Friend SqlConnection As System.Data.SqlClient.SqlConnection
Friend sqlAdapter As System.Data.SqlClient.SqlDataAdapter
Friend sqlCmd As System.Data.SqlClient.SqlCommand
Friend dsInfo
Friend sqlCmdBuilder As System.Data.SqlClient.SqlCommandBuilder
------------------------the Load event--------------------
SqlConnection = New SqlConnection(sConnection)
sqlCmd = New SqlCommand("SELECT PeopleID, Directory, PublishIt, FirstName, LastName, Address1, Address2, Address3, Zip, City, State, Country, Phone, Fax, Website, Email, DatelastModified from tPeople", SqlConnection)
sqlAdapter = New SqlDataAdapter(sqlCmd)
sqlCmdBuilder = New SqlCommandBuilder(sqlAdapter)
dsInfo = New DataSet
SqlConnection.Open()
sqlCmd.CommandText = "SELECT PeopleID, Directory, PublishIt, FirstName, LastName, Address1, Address2, Address3, Zip, City, State, Country, Phone, Fax, Website, Email, DatelastModified from tPeople"
sqlAdapter.Fill(dsInfo, "Services")
-----------------the button click-------------------
dsInfo.Tables("services").Rows(0).BeginEdit()
dsInfo.Tables("Services").Rows(0).Item("Address1") = "1111"
dsInfo.Tables("services").Rows(0).EndEdit()
dsInfo.Tables("services").Rows(0).AcceptChanges()
sqlAdapter.Update(dsInfo, "Services")
dsInfo.AcceptChanges()
----------------comments----------------------------
I put a break on the AcceptChanges line to see the RowState for that particular row and it is classified as "unchanged"
Even though the Row shows the new value and once the click code is finished the *text box* on the *form* for address1 does get updated to that value.
It won't save to the database either.
Other case is if I type something in a text box itself (instead of using code behind) it does the same thing. the Row adn field itself reflects the changes. However, the row state is classified as "unchanged" and it won't save to the database.
So whether I use a form to put in the value to the dataset or use code behind and do it by hand, I am not getting it to work.
What am I doing wrong? I know I must be missing something.. Either that or the gremlins got my computer
Any help is greatly appreciated!
Angela