N
news.public.microsoft.com
Hello all!
I'm having an issue with an asp.net app (vb.net code) and ado.net. I've
written up the following piece of code everything I've read says it should
work without an issue. Debugging I see that after the last line of code
executes my myDataTable object has one additional row in it as it should.
Using the command window I can check the data contained in the last row and
is indeed the data from the rows trying to be inserted into the table. The
issue is that the data never actually makes it into the database. No errors
are reported and everything executes fine. Am I missing something else that
needs to be committed or sync'd? Thanks for any information you guys/gals
might have to offer.
'--------------- Code starts -------------------'
Dim connectionString As String
connectionString = "Server=localhost; uid=sa; pwd=sapassword; database=test"
Dim commandString As String
commandString = "Select * from " & Application("UnreleasedTimeTable")
Dim myDataAdapter As New System.Data.SqlClient.SqlDataAdapter(commandString,
connectionString)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet)
Dim myDataTable As DataTable = myDataSet.Tables(0)
Dim newRow As DataRow = myDataTable.NewRow
newRow("UserID") = Session("UserObj").TraverseUserID
newRow("Code") = cboType.SelectedValue.ToString
newRow("TDate") = cboDate.SelectedValue.ToString
myDataTable.Rows.Add(newRow)
'--------------- Code ends -------------------'
Regards,
-Tony
I'm having an issue with an asp.net app (vb.net code) and ado.net. I've
written up the following piece of code everything I've read says it should
work without an issue. Debugging I see that after the last line of code
executes my myDataTable object has one additional row in it as it should.
Using the command window I can check the data contained in the last row and
is indeed the data from the rows trying to be inserted into the table. The
issue is that the data never actually makes it into the database. No errors
are reported and everything executes fine. Am I missing something else that
needs to be committed or sync'd? Thanks for any information you guys/gals
might have to offer.
'--------------- Code starts -------------------'
Dim connectionString As String
connectionString = "Server=localhost; uid=sa; pwd=sapassword; database=test"
Dim commandString As String
commandString = "Select * from " & Application("UnreleasedTimeTable")
Dim myDataAdapter As New System.Data.SqlClient.SqlDataAdapter(commandString,
connectionString)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet)
Dim myDataTable As DataTable = myDataSet.Tables(0)
Dim newRow As DataRow = myDataTable.NewRow
newRow("UserID") = Session("UserObj").TraverseUserID
newRow("Code") = cboType.SelectedValue.ToString
newRow("TDate") = cboDate.SelectedValue.ToString
myDataTable.Rows.Add(newRow)
'--------------- Code ends -------------------'
Regards,
-Tony