Home > Archive > MS SQL Server ODBC > January 2006 > Insert command not affecting the table but is recognized by profil









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Insert command not affecting the table but is recognized by profil
Neo

2006-01-20, 11:23 am

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;Databas
e=BSP_TEST;Uid=sa;Pw
d=HCL1767;"
Dim objConn As New SqlConnection(connSt
r)

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(da
BSP)
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
RDBSAdmin

2006-01-21, 1:23 pm

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;Databas
e=BSP_TEST;Uid=sa;Pw
d=HCL1767;"
> Dim objConn As New SqlConnection(connSt
r)
>
> 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(da
BSP)
> 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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com