473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Command.Execute Error (ADO.NET)

I am getting the following error from my error handling code:

5 - Expected query name after EXECUTE..

from the following code:

Public Sub insert(ByVal argSql As String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim myCommand As New OleDbCommand()

myCommand.Connection = myConnection
myCommand.CommandType = CommandType.StoredProcedure
myCommand.CommandText = argSql

Try
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch
DisplayErrorMessage("clsDatabase:insertData")
End Try

End Sub

Any ideas??

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
5 2412
* Ivan Weiss <iv*****@optonline.net> scripsit:
I am getting the following error from my error handling code:

5 - Expected query name after EXECUTE..

from the following code:

Public Sub insert(ByVal argSql As String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim myCommand As New OleDbCommand()

myCommand.Connection = myConnection
myCommand.CommandType = CommandType.StoredProcedure
myCommand.CommandText = argSql

Try
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch
DisplayErrorMessage("clsDatabase:insertData")
End Try

End Sub

Any ideas??


Group for ADO.NET questions:

<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.adonet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
I can think of a couple of things right off that could cause that error.

1) Is the stored procedure attempting to return data?
2) The stored procedure is incorrect in that it is returning this error.

Hope these help, it is difficult to help without more information, i.e. the
text of the stored procedure and the value of argSQL.

David

"Ivan Weiss" <iv*****@optonline.net> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
I am getting the following error from my error handling code:

5 - Expected query name after EXECUTE..

from the following code:

Public Sub insert(ByVal argSql As String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim myCommand As New OleDbCommand()

myCommand.Connection = myConnection
myCommand.CommandType = CommandType.StoredProcedure
myCommand.CommandText = argSql

Try
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch
DisplayErrorMessage("clsDatabase:insertData")
End Try

End Sub

Any ideas??

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3
It sounds like your sql string is invalid and that either the stored
procedure does not exist or has not been specified.

OHM

Ivan Weiss wrote:
I am getting the following error from my error handling code:

5 - Expected query name after EXECUTE..

from the following code:

Public Sub insert(ByVal argSql As String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim myCommand As New OleDbCommand()

myCommand.Connection = myConnection
myCommand.CommandType = CommandType.StoredProcedure
myCommand.CommandText = argSql

Try
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch
DisplayErrorMessage("clsDatabase:insertData")
End Try

End Sub

Any ideas??

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #4
Sorry guys it was a dumb mistake. I had the command object set to
stored procedure when I was generated the sql statement so it should
have been text.

Thanks

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
COOL, At least u fixed it !

OHM
Ivan Weiss wrote:
Sorry guys it was a dumb mistake. I had the command object set to
stored procedure when I was generated the sql statement so it should
have been text.

Thanks

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Cath B | last post by:
I am pretty sure I am getting a command timeout when execute a SQL procedure that has an output parameter. The code below is in an asp page that is called using RSGetASPObject. I want to be able...
3
by: Brian | last post by:
hi, when i want to do an action to the database i am using the command Set myConn = Server.CreateObject("ADODB.Connection") myConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &...
5
by: Bruno Alexandre | last post by:
Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under the recorset object.... how can I do this? I'm...
3
by: Jenni | last post by:
Hi, my simple solution is not so simple. I have done a bit of VB programming, and am now tasked with trying to make access work using VBA, and battling my butt off. This probably has a really...
2
by: Norman Fritag | last post by:
Hi there The below code executes some queries. As newbie I was wondering weather you are better of using connection execute or command execute to execute queries? I am asking as...
5
by: Teo | last post by:
Hi! Sorry for my many postings on this Newsgroup. I am new to ADO.NET and I got Sceppa's book on ADO.NET. It's a great book but covers a lot on the DataAdapter and Offline Data. Now, if I want to...
12
by: alan | last post by:
Can VB.NET directly executing the sql command for insert, update and delete but not using data adapter.insertcomand, adapter.deletecomand, adapter.updatecomand? Just like in VB6 , I can directly...
4
by: George Shawn | last post by:
Hi, I am running into an extremely frustrating problem and after hours of troubleshooting have not made any progress. When I try to use the ADO Command object to update a table, I receive the...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.