vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I've been trying to add a simple record to SQL Server 2000 and it is not recognizing the insert statement. The SQL profiler is picking up the command from the application, but it is not updating the table with the new record. If there are any suggestions, it would be appreciated. Here is my code Dim dsBSP As New DataSet("BSP_Test") Dim dt As New DataTable Dim connStr As String = "Server=tiger;Database=BSP_TEST;Uid=sa;Pwd=HCL1767 ;" Dim objConn As New SqlConnection(connStr) objConn.Open() daBSP.FillSchema(dsBSP, SchemaType.Source, "BSP") daBSP.Fill(dsBSP, "BSP") lstDisplay.DataSource = dsBSP Dim tblBSP As DataTable tblBSP = dsBSP.Tables("BSP") Dim objCommandBuilder As New SqlCommandBuilder(daBSP) daBSP.InsertCommand = New SqlCommand("Insert Into BSP(DT_CRTD) values (Now())", objConn) As mentioned, the insertcommand is being noticed by the profiler but not affecting the table. I also tried to use the .Update statement (assuming it would commit any changes) but this just gives me an unhandled exception/System Error Please Help |
| ||||
| 1. Do you receive any error when you try to insert a record? 2. Can you issue SELECT @@VERSION statement via Query Analyzer and post here the result of the execution? "Neo" wrote: > I've been trying to add a simple record to SQL Server 2000 and it is not > recognizing the insert statement. The SQL profiler is picking up the command > from the application, but it is not updating the table with the new record. > If there are any suggestions, it would be appreciated. > Here is my code > > Dim dsBSP As New DataSet("BSP_Test") > Dim dt As New DataTable > Dim connStr As String = > "Server=tiger;Database=BSP_TEST;Uid=sa;Pwd=HCL1767 ;" > Dim objConn As New SqlConnection(connStr) > > objConn.Open() > daBSP.FillSchema(dsBSP, SchemaType.Source, "BSP") > daBSP.Fill(dsBSP, "BSP") > lstDisplay.DataSource = dsBSP > > Dim tblBSP As DataTable > tblBSP = dsBSP.Tables("BSP") > > > Dim objCommandBuilder As New SqlCommandBuilder(daBSP) > daBSP.InsertCommand = New SqlCommand("Insert Into BSP(DT_CRTD) > values (Now())", objConn) > > As mentioned, the insertcommand is being noticed by the profiler but not > affecting the table. > I also tried to use the .Update statement (assuming it would commit any > changes) > but this just gives me an unhandled exception/System Error > Please Help |