Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What error is this?? 1

Status
Not open for further replies.

smash81

Programmer
Mar 12, 2001
88
KE
Hello,
I am trying to make a small application.I have the main screen on which a form is displayed with a
drop down box and a radio button.
Once the user select the number from the drop down and clicks the radio button and submit, the following
script is to be executed.
Now this refers to an access query where i am to pass two parameters.However when i execute the script
with the following code:

<html>
<head>
<title> Auction Details</title>
</head>

<body>
<%

dim conn,rs,comm
set comm=server.createobject(&quot;adodb.command&quot;)
set conn=server.createobject(&quot;adodb.connection&quot;)
set rs=server.createobject(&quot;adodb.recordset&quot;)

conn.open &quot;DSN=mydbase&quot;

comm.activeconnection=conn
comm.commandtext=&quot;details&quot;
comm.commandtype=2

comm.Parameters.Append comm.createparameter (&quot;abc&quot;,adInteger,adparameterinput)

comm.parameters.append comm.createparameter(&quot;xyz&quot;,advarchar,adparameterinput)
comm.parameters(0).value=request.querystring(&quot;number&quot;)
comm.parameters(1).value=request.querystring(&quot;radio&quot;)
set rs=comm.execute

(PS this is just part of the script and i strongly feel that the error is coming from here.)

When i execute the script i get the following error:

ADODB.Command error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/man/list.asp, line 26

Please help me resolve this problem
The datatypes in the database are
integer and text


 
I have a feeling this is because the two variables you are trying to place into the array are of different data types. The number is obviously an integer, whereas the radio button returns a boolean. The problem is that an array can only hold 1 data type.

Hope this helps...

Gee -GTM Solutions, Home of USITE-
-=
 
Thank you but i also tried to use the refresh method.And this also does not work.
is there anything else that i can try?
 
My apologise I misread your code. Im afraid I don't know anything about using this method to execute access queries.

Sorry!

G -GTM Solutions, Home of USITE-
-=
 
Hello,
As far as I understood you have MS Access Database with DSN &quot;mybase&quot; and parametrized query named details. And you are trying to pass parameters to that query.
If you were using MS SQL server I would say that it is stored procedure with parameters and you mistyped the commandtype. I checked with MSDN and it is the same with MS Access queries.
You have used
comm.commandtype=2 ( or =adCmdTable) which means that you are using a table name whose columns are all returned by an internally generated SQL query.
So you need
comm.commandtype=4 (or =adCmdStoredProc) which means you are using a stored procedure name (or query in Access terms).

Then I again checked your code and got the same error!
Tried to replace
comm.Parameters.Append comm.createparameter(&quot;abc&quot;,adInteger,adparameterinput)

with

comm.Parameters.Append comm.createparameter(&quot;abc&quot;,3,1)

and everything was OK. You could also use these integers.

Or as I think you forgot to include adobvs.inc where all constants have their corresponding integers.
Use somewhere between the <head> </head>
<!-- #include file=&quot;adovbs.inc&quot; -->
And copy to your project folder file adovbs.inc.
You can find it somewhere on your disk (it is shipped with MS Interdev) or you can download from MS site recent version.

Hope this helps.
D.
 
I really appreciate this it seems to be working to a certain extent.Please tell me how you get these numbers e.g the (&quot;&quot;,3,1) which section of MSDN do you get them from?
And you guessed right.The database is access and the details is a query.
 
Hello, smash81,
From main page of MSDN - library or direct to
You have to follow the hierarchy of links to Platform SDK Documentation, Data Services, Microsoft Data Access Components (MDAC) SDK, Microsoft ActiveX Data Objects (ADO), ADO Programmer's Reference, ADO API Reference,
ADO Objects, Command Object, Command Object Properties, Methods, and Events
From there to the CreateParameters, DataTypeEnum, etc.
I'm including a direct link to Command object, but I think it is better to browse ADO API Reference, or ADO Programmer's Guide.

I would recommend reading an article about adovbs.inc

Success with your task.
D.
 
Thank you so much.
I had tried usinga file called msado15.dll.Will this work? i had read about it in a book.
One more thing, to avoid all these problems, i tried using the comm.parameters.refresh method and i got the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e51'

Provider cannot derive parameter information and SetParameterInfo has not been called


Now what is this???? Please help again
 
Hello, smash81,
I think that msado15.dll will work in VB project, not in ASP.
For the Refresh method I found following explanation:
&quot;Typical uses of the Parameters.Refresh method of the Active Data Objects (AD0) command object to determine parameter information for the query. However, the Microsoft OLE DB Provider for Access does not return the parameters collection back to ADO; hence ADO returns the error.&quot;
And it seems that is behaviour by design.

So you have to give to your command paramaters with appropriate type.
Hope this helps.
D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top