Quantcast
Channel: SQL Server Compact Forum
Viewing all articles
Browse latest Browse all 193

SQLCE 3.5 VS2008 - VB.NET Refuses to INSERT

$
0
0

Hi all,

I have a small vb.net app and am using SQLCE to store the data. I have written a small sub to store a record in the DB but it seems to refuse to work. Here is the code:

Dim ConnCeSQL = New SqlCeConnection(My.Settings.CollectorConnectionString)
ConnCeSQL.Open()

Dim CmdCeSQL = New SqlCeCommand("INSERT INTO tbl_Application_Data_Collections([Name], [Building], [Room], [Room Code],[Created]) VALUES('Test','Test','Test','Test','01/02/2012')", ConnCeSQL)
       
CmdCeSQL.ExecuteNonQuery()
ConnCeSQL.Close()

Effectively the code seems to function but when I check the table, no record has been added. I don't receive any error messages.

I know that the code can access the table, as if I force an issue with a field name, an error comes back telling me that the column doesn't exist.

I have added a few message boxes into the code too to capture the connection state and also the number of rows affected. I can see the connection is open and that it returns 1 affected row, but no data.......

If I copy the INSERT command into the SQLCE editor within VS2008 and execute it, a new row is inserted.

I am at a loss now, to be honest.

I hope that someone can tell me what i'm doing wrong.

Many Thanks

Simon


Viewing all articles
Browse latest Browse all 193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>