RE: Command contains unrecognized phrase/keyword VB.Net
- From: v-kevy@xxxxxxxxxxxxxxxxxxxx (Kevin Yu [MSFT])
- Date: Mon, 14 Aug 2006 02:17:02 GMT
Hi,
You're getting the exception because you're concatenating strings to build
the SQL statement. The value for those fields might be invalid for SQL
statement. Thus, it'll be better to use paremeters.
sql = "Insert into edifile (theirref,qtnord ) Values (?, 'RRTo')
Public gconnMDB_I As OleDb.OleDbConnection
gconnMDB_I = New OleDb.OleDbConnection
gconnMDB_I.ConnectionString = lstrConnString
Call gconnMDB_I.Open()
Dim cmd As New OleDb.OleDbCommand
cmd = New OleDb.OleDbCommand(sql, gconnMDB_I)
cmd.Parameters.Add("lstrdata", System.Data.OleDb.OleDbType.Char, 100)
'Use parameter here.
cmd.Parameters("lstrdata").Value = lstrdata 'Assign value to it.
cmd.ExecuteNonQuery()
Kevin Yu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
.
- Follow-Ups:
- RE: Command contains unrecognized phrase/keyword VB.Net
- From: Kevin Yu [MSFT]
- RE: Command contains unrecognized phrase/keyword VB.Net
- References:
- Command contains unrecognized phrase/keyword VB.Net
- From: Komandur Kannan
- Command contains unrecognized phrase/keyword VB.Net
- Prev by Date: Re: VS2003 hangs creating ASP.NET webservice
- Next by Date: Re: VS2003 hangs creating ASP.NET webservice
- Previous by thread: Command contains unrecognized phrase/keyword VB.Net
- Next by thread: RE: Command contains unrecognized phrase/keyword VB.Net
- Index(es):
Relevant Pages
|