Re: INSERT statement using variables
From: Herfried K. Wagner [MVP] (hirf-spam-me-here_at_gmx.at)
Date: 11/02/04
- Next message: Michael Turner: "Images that are used alot"
- Previous message: Herfried K. Wagner [MVP]: "Re: Show user-defined comments for user-defined functions"
- In reply to: sm: "INSERT statement using variables"
- Next in thread: Cor Ligthert: "Re: INSERT statement using variables"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Nov 2004 12:15:00 +0100
"sm" <sm@discussions.microsoft.com> schrieb:
> Can anybody give me the syntax to insert a record into
> SQL server through VB code using variables?
>
> The following statement is failing!
> sInsertQuery = "INSERT INTO TestTab (Col1, Col2, Col3, Col4) Values(" & _
> str1 & "," & dt1 & "," & str2 & "," & str3 & ")"
Use an 'InsertCommand' + parameters instead:
Using Parameters with a 'DataAdapter'
<URL:http://msdn.microsoft.com/library/en-us/cpguide/html/cpconusingparameterswithdataadapters.asp>
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/>
- Next message: Michael Turner: "Images that are used alot"
- Previous message: Herfried K. Wagner [MVP]: "Re: Show user-defined comments for user-defined functions"
- In reply to: sm: "INSERT statement using variables"
- Next in thread: Cor Ligthert: "Re: INSERT statement using variables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|