|
-
Aug 25th, 2005, 03:31 PM
#1
Thread Starter
Addicted Member
[RESOLVED] insert command
is there something wrong with the insert sql string in sql ce?
i am using "insert into table (field1) values (value1);" and it tells me that that is an unacceptable command in sqlce. what is the other way to do variables?
it looks something like this
VB Code:
insert into table (field1) values (?)
cecmd.sqlparamets.add("field1", value1)
can i get a little help?
-
Aug 26th, 2005, 03:14 AM
#2
Fanatic Member
Re: insert command
Is this what you mean?
Dim value1 As String = "xxxxx"
INSERT INTO Table (field1) Values ('" & value1 & "')"
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Aug 26th, 2005, 07:33 AM
#3
Thread Starter
Addicted Member
Re: insert command
no it looks like what i posted. "the function is not recognized by sql server"
-
Aug 26th, 2005, 07:34 AM
#4
Thread Starter
Addicted Member
Re: insert command
VB Code:
Dim cecmd As SqlCeCommand = New SqlCeCommand( _
"insert into received (jobnum, boxnum, weight, numberrecvd, bay, recdate)" & _
" values (" & CInt(lblJobnum.Text) & ", " & CInt(txtBoxnum.Text) & ", " & _
CDec(txtWeight.Text) & ", " & CInt(txtNReceived.Text) & ", '" & _
txtBay.Text & "', now());", ceconn)
cecmd.ExecuteNonQuery()
-
Aug 26th, 2005, 08:04 AM
#5
Fanatic Member
Re: insert command
use getDate() instead of now()
dont think there is any need for the ; at the end, well i never use it anyway.
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Aug 26th, 2005, 08:20 AM
#6
Thread Starter
Addicted Member
Re: insert command
now is an sql command for datetime which is what i need. anyway i fixed my problem.
-
Aug 26th, 2005, 08:23 AM
#7
Fanatic Member
Re: [RESOLVED] insert command
getDate() does the same, its sql servers in built function of getting the date & time from the device
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|