473,748 Members | 8,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VERY strange issue with SQL 2000 + ADO Command object

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 following error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
No value given for one or more required parameters.
Here is the entirety of the code that is running:

Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Open Application("Ap p_ConnectionStr ing")

Set Cmd = CreateObject("A DODB.Command")
Cmd.ActiveConne ction = Conn
Cmd.CommandType = adCmdText
Cmd.Prepared = True

Cmd.CommandText = "UPDATE tblFile SET UserID = ?"

Set var1 = Cmd.CreateParam eter("UserID", adInteger, adParamInput)
var1.Value = 1
Cmd.Execute

Set Cmd = Nothing
Conn.Close
Set Conn = Nothing
I use this syntax all over the site with much more complicated queries, and
have never come across this error before. Here is where it gets really
funky..... I've logged var1.Value right before executing the command, and
that is returning the correct value. However the "no value given" error
message persists! If I take the exact same SQL statement and run it from SQL
Management Studio, it runs without a hitch. Additionally if I change the ?
to the value itself, then it also runs no problem.
Now when I comment out the line "Cmd.Prepar ed = True" then I receive a
slightly different error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
When I run a database trace, I can see that the statement is not actually
run on the server. So this looks to be some kind of driver problem. With
"Cmd.Prepar ed = True" the only thing run on the server is "SET FMTONLY ON
select UserID from tblFile where 1=2 SET FMTONLY OFF"
I have dropped every DDL dependencies (all two of them) so that should not
be a problem. I can change the CommandText to something crazy like
"UzzzzPDATE tblzzzzFile zzzz SEzzzT UszzzzerID = ?" and still get the same
two error messages. Heck, I've even gone so far as to remove the entire
TABLE from the database and I am *still* getting the same two error messages
complaining that I am missing a parameter. Only when I hardcode the UserID
value in the CommandText does it tell me the table does not exist.

Please help..... Any idea as to what is going on? This is killing me.

Thanks in advance.

Regards,
Mike
Jan 17 '07 #1
4 5155
Sorry, I forgot to mention a couple of details:

I am running IIS/ASP on Windows XP SP 2 with MDAC 2.8 SP1. SQL Server 2000
Standard SP4 is running on a network machine that is running Windows 2003
Server Standard SP1.

The error is occurring on the "Cmd.Execut e" line, though that was probably
obvious.

Thanks,
Mike M

"George Shawn" <ge****@nospam. comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
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 following error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
No value given for one or more required parameters.
Here is the entirety of the code that is running:

Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Open Application("Ap p_ConnectionStr ing")

Set Cmd = CreateObject("A DODB.Command")
Cmd.ActiveConne ction = Conn
Cmd.CommandType = adCmdText
Cmd.Prepared = True

Cmd.CommandText = "UPDATE tblFile SET UserID = ?"

Set var1 = Cmd.CreateParam eter("UserID", adInteger, adParamInput)
var1.Value = 1
Cmd.Execute

Set Cmd = Nothing
Conn.Close
Set Conn = Nothing
I use this syntax all over the site with much more complicated queries,
and have never come across this error before. Here is where it gets really
funky..... I've logged var1.Value right before executing the command, and
that is returning the correct value. However the "no value given" error
message persists! If I take the exact same SQL statement and run it from
SQL Management Studio, it runs without a hitch. Additionally if I change
the ? to the value itself, then it also runs no problem.
Now when I comment out the line "Cmd.Prepar ed = True" then I receive a
slightly different error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
When I run a database trace, I can see that the statement is not actually
run on the server. So this looks to be some kind of driver problem. With
"Cmd.Prepar ed = True" the only thing run on the server is "SET FMTONLY ON
select UserID from tblFile where 1=2 SET FMTONLY OFF"
I have dropped every DDL dependencies (all two of them) so that should not
be a problem. I can change the CommandText to something crazy like
"UzzzzPDATE tblzzzzFile zzzz SEzzzT UszzzzerID = ?" and still get the same
two error messages. Heck, I've even gone so far as to remove the entire
TABLE from the database and I am *still* getting the same two error
messages complaining that I am missing a parameter. Only when I hardcode
the UserID value in the CommandText does it tell me the table does not
exist.

Please help..... Any idea as to what is going on? This is killing me.

Thanks in advance.

Regards,
Mike


Jan 17 '07 #2
You forgot to append the new parameter to the collection.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"George Shawn" <ge****@nospam. comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
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 following error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
No value given for one or more required parameters.
Here is the entirety of the code that is running:

Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Open Application("Ap p_ConnectionStr ing")

Set Cmd = CreateObject("A DODB.Command")
Cmd.ActiveConne ction = Conn
Cmd.CommandType = adCmdText
Cmd.Prepared = True

Cmd.CommandText = "UPDATE tblFile SET UserID = ?"

Set var1 = Cmd.CreateParam eter("UserID", adInteger, adParamInput)
var1.Value = 1
Cmd.Execute

Set Cmd = Nothing
Conn.Close
Set Conn = Nothing
I use this syntax all over the site with much more complicated queries,
and have never come across this error before. Here is where it gets really
funky..... I've logged var1.Value right before executing the command, and
that is returning the correct value. However the "no value given" error
message persists! If I take the exact same SQL statement and run it from
SQL Management Studio, it runs without a hitch. Additionally if I change
the ? to the value itself, then it also runs no problem.
Now when I comment out the line "Cmd.Prepar ed = True" then I receive a
slightly different error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
When I run a database trace, I can see that the statement is not actually
run on the server. So this looks to be some kind of driver problem. With
"Cmd.Prepar ed = True" the only thing run on the server is "SET FMTONLY ON
select UserID from tblFile where 1=2 SET FMTONLY OFF"
I have dropped every DDL dependencies (all two of them) so that should not
be a problem. I can change the CommandText to something crazy like
"UzzzzPDATE tblzzzzFile zzzz SEzzzT UszzzzerID = ?" and still get the same
two error messages. Heck, I've even gone so far as to remove the entire
TABLE from the database and I am *still* getting the same two error
messages complaining that I am missing a parameter. Only when I hardcode
the UserID value in the CommandText does it tell me the table does not
exist.

Please help..... Any idea as to what is going on? This is killing me.

Thanks in advance.

Regards,
Mike


Jan 17 '07 #3
George Shawn wrote:
>
Set var1 = Cmd.CreateParam eter("UserID", adInteger, adParamInput)
var1.Value = 1
Cmd.Execute

Set Cmd = Nothing
Conn.Close
Set Conn = Nothing
You failed to append the parameter object to the Command's Parameters
collection before executing the Command:

Cmd.Parameters. Append var1
Cmd.Execute
Actually, in this case, you don't even need to bother with CreateParameter .
Use the second argument of the Command's Execute method to pass a variant
array containing the parameter values to the query engine:

arParms = Array(1)
Cmd.Execute ,arParms, 1 '1=adCmdText

You can pass as many parameter values as needed.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jan 17 '07 #4
Wow, I cannot believe I didn't catch that.... crazy.

Thanks to you and Bob for the very prompt reply!

Thanks,
Mike
"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:uC******** ******@TK2MSFTN GP06.phx.gbl...
You forgot to append the new parameter to the collection.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"George Shawn" <ge****@nospam. comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>Hi,

I am running into an extremely frustrating problem and after hours of
troubleshootin g have not made any progress. When I try to use the ADO
Command object to update a table, I receive the following error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
No value given for one or more required parameters.
Here is the entirety of the code that is running:

Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Open Application("Ap p_ConnectionStr ing")

Set Cmd = CreateObject("A DODB.Command")
Cmd.ActiveConn ection = Conn
Cmd.CommandTyp e = adCmdText
Cmd.Prepared = True

Cmd.CommandTex t = "UPDATE tblFile SET UserID = ?"

Set var1 = Cmd.CreateParam eter("UserID", adInteger, adParamInput)
var1.Value = 1
Cmd.Execute

Set Cmd = Nothing
Conn.Close
Set Conn = Nothing
I use this syntax all over the site with much more complicated queries,
and have never come across this error before. Here is where it gets
really funky..... I've logged var1.Value right before executing the
command, and that is returning the correct value. However the "no value
given" error message persists! If I take the exact same SQL statement and
run it from SQL Management Studio, it runs without a hitch. Additionally
if I change the ? to the value itself, then it also runs no problem.
Now when I comment out the line "Cmd.Prepar ed = True" then I receive a
slightly different error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
When I run a database trace, I can see that the statement is not actually
run on the server. So this looks to be some kind of driver problem. With
"Cmd.Prepare d = True" the only thing run on the server is "SET FMTONLY ON
select UserID from tblFile where 1=2 SET FMTONLY OFF"
I have dropped every DDL dependencies (all two of them) so that should
not be a problem. I can change the CommandText to something crazy like
"UzzzzPDATE tblzzzzFile zzzz SEzzzT UszzzzerID = ?" and still get the
same two error messages. Heck, I've even gone so far as to remove the
entire TABLE from the database and I am *still* getting the same two
error messages complaining that I am missing a parameter. Only when I
hardcode the UserID value in the CommandText does it tell me the table
does not exist.

Please help..... Any idea as to what is going on? This is killing me.

Thanks in advance.

Regards,
Mike



Jan 17 '07 #5

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

Similar topics

4
9743
by: Stefano | last post by:
Hi everibody, it's the first time i post on this newsgroup. I'm Stefano from Milano, italy. I'm a beginners with Sql2000. My problem is this. I run a View using enterprise manager and after less then 20 second it goes in error time out. I run this view using a VB application and the error comes again .When i run it with Query Analyzer after 50 seconds it give me the right result. i've tried to change the value of querytimeout using...
24
4748
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone out there has run into this issue before and can shed some light on it for me. I have a stored procedure that essentially does a mini ETL from a source OLTP DB to a the target Operational Data Store. This is still in development so both DB's reside on the same machine for convenience. The stored proc runs successfully from within Query analyzer and this holds true on the following platforms: XP...
2
1479
by: Neil | last post by:
I have a strange situation. I have a stored procedure that is hanging upon execution, but only some machines and not others. The db is an Access 2000 MDB using ODBC linked tables and a SQL 7 back end. The sp is executed as a pass-through. The sp is fairly simple: UPDATE CUSTOMER SET LastMergeName = . FROM (CUSTOMER C INNER JOIN MergeItems I ON C. = I.)
25
3732
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's machines. The code opens MS Word through Automation and then opens a particular Word doc. It's still working fine on most machines; but on one or two of them, the user is getting an Automation Error. The code used is as follows: Dim objWord As...
9
10503
by: Vito DeCarlo | last post by:
I've been having this problem for a few weeks. PLEASE read this post before responding with some simple reason that has nothing to do with my problem. If you need more information, please request it as I'll be checking this post very often. PROBLEM: Occaisionally, our web server begins running ASP.NET pages extremely slowly. Other websites on the server run fine, including ASP pages. It almost seems as if the .NET caching system...
10
2505
by: Trapulo | last post by:
Why Now.Date.Subtract(New Date(2000, 1, 1)).Days returns 731529?? It is a too big value a think! I aspect something as 1030-1100....
1
2338
by: Raziq Shekha | last post by:
Hi Folks, SQL Server 2000 SP3 on Windows 2000. I have a database on which I ran the command : dbcc dbreindex ('tablename') go for all tables in the database. Then I compared the dbcc showcontig with all_index output from before and after the reindex and on the
11
2491
by: Mike C# | last post by:
Hi all, I keep getting a strange error and can't pin it down. The message is: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. However I'm not purposely requesting that the Runtime terminate in an "unusual way." The line that is causing me headaches is:
3
6730
by: Max Vit | last post by:
I have come across a strange issue whilst trying to use a shell command call from Access and have spent some time trying to figure this out but can't find the cause as yet. The issue is: I need to execute a command call from within Access to execute a batch file (sample.bat). To do this, we use the Shell function, something like: Shell "cmd /c sample.bat"
0
8828
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.