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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Command error '800a0bb9' Arguments are of the wrong Type 1

Status
Not open for further replies.

Kathleen422

Technical User
Apr 9, 2004
12
0
0
US
Hi all, I keep getting a error on this on the
objCommand.CommandType = adCmdText

Can't figure out for the life of me what I am doing wrong. Please help


<! -- #include file="adovbs.inc" -->

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Temporary Labor Inquiry</title>
</head>


<font color="#CE0000" face="Century Gothic" size="4"><b>TEMPORARY LABOR </b></font><br>
<a href="../../Default.asp">Home</a><br>&nbsp;&nbsp;&nbsp; <br>

<div align="left">
<table border="1" width="1500" height="40">
<tr>
<td width="1200" align = "center" colspan="11">
<p align="left"><b><font color="#CE0000" face="Century Gothic">
CONFIDENTIAL INFORMATION</font></b></td>
</tr>

<tr>
<td width="100" align = "center">Invoice No.</td>
<td width="100" align = "center">Invoice Date</td>
<td width="100" align = "center">Wk. Ending</td>
<td width="100" align = "center">Cost Center</td>
<td width="150" align = "left">Name</td>
<td width="100" align = "right">Rate</td>
<td width="150" align = "left">Description</td>
<td width="100" align = "right">Regular Hours</td>
<td width="100" align = "right">Time & a Half</td>
<td width="100" align = "right">Double Time </td>
<td width="100" align ="right">Amount</td>
</tr>

<%

Dim objCommand, objRs, strConnect

Set objCommand = Server.CreateObject("ADODB.Command")

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & server.mappath("../../fpdb/VWF.mdb") & ";" & _
"User Id=admin;" & "Password=;"

objCommand.ActiveConnection = strConnect
objCommand.CommandText = "SELECT * FROM tblInvoicing " & _
"INNER JOIN tblCostCenters ON tblInvoicing.Cost_Center = tblCostCenters.CostCtr " & _
"WHERE Invoice_Number =('" & request.form("InvoiceNumber") & "') AND ((tblCostCenters.Div)='AF')"

objCommand.CommandType = adCmdText
Set objRs = objCommand.Execute
set objCommand = Nothing

while not objRs.eof

Response.write "<tr><td align = center>" & objRs("Invoice_Number") & "</td>"
Response.write "<td align=center>" & objRs("Invoice_Date") & "</td>"
Response.write "<td align=center>" & objRs("Time_Card_Wk_Ending") & "</td>"
Response.write "<td align=center>" & objRs("Cost_Center") & "</td>"
Response.write "<td align=left>" & objRs("Name") & "</td>"
Response.write "<td align=right>" & (formatcurrency(objRs("Regular_Rate"))) & "</td>"
Response.write "<td align=left>" & objRs("Pay_Bill_Description")& "</td>"
Response.write "<td align=right>" & objRs("Regular_Hours") & " hrs = " & (formatcurrency(objRs("Regular_Bill_Amt"))) & "</td>"
Response.write "<td align=right>" & objRs("Premium_Hours") & " hrs = " & (formatcurrency(objRs("Premium_Bil_Amount"))) & "</td>"
Response.write "<td align=right>" & objRs("Doubletime_Hours") & "hrs = " & (formatcurrency(objRs("DoubleTime_Bil_Amt"))) &"</td>"
Response.write "<td align=right>" & (formatcurrency(objRs("Total_Billed_Amount"))) & "</td></tr>"

objRs.movenext

Wend

objRs.Close
Set objRs=nothing
%>

</table>
</div>
</body>
</html>
 
Shouldnt it be

objCommand.CommandText = adCmdText


thanks

VJ
 
Are you using adovbs.inc or the ado constant type library? If not then try this before you use "adCmdText".
Const adCmdText = &H0001
 
Thanks for response. But no this modification creates the following error.

Microsoft JET Database Engine error '80040e0c'
Command text was not set for the command object.
 
Using adovbs.inc

Fairly new to this so am basically using an example in Wrox Books all to no avail.

If I add in the line Const adCmdText = &H0001

I get the following:

Microsoft JET Database Engine error '80040e14'
Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
 
I usually order things: cmdType, cmdText and use the type library:
Code:
<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\System\ADO\msado20.tlb" --> 

With cmd
  .CommandType=4
  .CommandText = "INSERT_NEW_USER OR WHATEVER"
  .execute ,,adexecutenorecords
end with
 
Oops, Sorry misread the post.

Veep' suggestion will work.

Thanks

VJ
 
Ok, you had it correct when you were trying to use CommandType. CommandText is strictly for the SQL statement, table name, stored procedue named, etc. Basically it is what will be executed. CommandType is the type of argument that is in CommandText, in this case a text (or sql) argument as opposed to a table or stored procedure.

One thing I would suggest is to start off your page with
Code:
<%
Option Explicit
%>
That way id adCmdText is somehow not declared it will give you an error message (as well as catching any spelling errors, etc in later variable usage).

adCmdText should be defined in adovbs.inc, I'll try this on a local db and see what error I get.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Just noticed something when pasting it into my editor:
Code:
<! -- #include file="adovbs.inc" -->

should be

<!-- #include file="adovbs.inc" -->
the space will mess it up. Try this in your original code. If you had tat space in your code then it would not have been importing the adovbs file correctly, leaving adCmdText undefined as was surmised by others above. rather than redefining it if you just remove the space you should be good to go.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
FYI. Disregard the "commandType=4" in my post. That's for a stored procedure. If you're using adovbs.inc then I would go with Tarwn's suggestion of <%Option Explicit%>
 
I have modified code as follows: Now I get the following:


Microsoft VBScript runtime error '800a01a8'
Object required: '[undefined]' on line 45

Line 45 being: With cmd




<! -- #include file="adovbs.inc" -->
<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\System\ADO\msado20.tlb" -->

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Temporary Labor Inquiry</title>
</head>


<font color="#CE0000" face="Century Gothic" size="4"><b>TEMPORARY LABOR </b></font><br>
<a href="../../Default.asp">Home</a><br>&nbsp;&nbsp;&nbsp; <br>

<div align="left">
<table border="1" width="1500" height="40">
<tr>
<td width="1200" align = "center" colspan="11">
<p align="left"><b><font color="#CE0000" face="Century Gothic">
CONFIDENTIAL INFORMATION</font></b></td>
</tr>

<tr>
<td width="100" align = "center">Invoice No.</td>
<td width="100" align = "center">Invoice Date</td>
<td width="100" align = "center">Wk. Ending</td>
<td width="100" align = "center">Cost Center</td>
<td width="150" align = "left">Name</td>
<td width="100" align = "right">Rate</td>
<td width="150" align = "left">Description</td>
<td width="100" align = "right">Regular Hours</td>
<td width="100" align = "right">Time & a Half</td>
<td width="100" align = "right">Double Time </td>
<td width="100" align ="right">Amount</td>
</tr>

<%

Dim objCommand, objRs, strConnect, cmd
set objCommand = Server.CreateObject("ADODB.Command")

With cmd
.CommandType=4
.CommandText = "SELECT * FROM tblInvoicing " & _
"INNER JOIN tblCostCenters ON tblInvoicing.Cost_Center = tblCostCenters.CostCtr " & _
"WHERE Invoice_Number =('" & request.form("InvoiceNumber") & "') AND ((tblCostCenters.Div)='AF')"
.execute ,,adexecutenorecords
end with

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & server.mappath("../../fpdb/VWF.mdb") & ";" & _
"User Id=admin;" & "Password=;"

objCommand.ActiveConnection = strConnect

objCommand.CommandType = 4
Set objRs = objCommand.Execute
set objCommand = Nothing

while not objRs.eof

Response.write "<tr><td align = center>" & objRs("Invoice_Number") & "</td>"
Response.write "<td align=center>" & objRs("Invoice_Date") & "</td>"
Response.write "<td align=center>" & objRs("Time_Card_Wk_Ending") & "</td>"
Response.write "<td align=center>" & objRs("Cost_Center") & "</td>"
Response.write "<td align=left>" & objRs("Name") & "</td>"
Response.write "<td align=right>" & (formatcurrency(objRs("Regular_Rate"))) & "</td>"
Response.write "<td align=left>" & objRs("Pay_Bill_Description")& "</td>"
Response.write "<td align=right>" & objRs("Regular_Hours") & " hrs = " & (formatcurrency(objRs("Regular_Bill_Amt"))) & "</td>"
Response.write "<td align=right>" & objRs("Premium_Hours") & " hrs = " & (formatcurrency(objRs("Premium_Bil_Amount"))) & "</td>"
Response.write "<td align=right>" & objRs("Doubletime_Hours") & "hrs = " & (formatcurrency(objRs("DoubleTime_Bil_Amt"))) &"</td>"
Response.write "<td align=right>" & (formatcurrency(objRs("Total_Billed_Amount"))) & "</td></tr>"

objRs.movenext

Wend

objRs.Close
Set objRs=nothing
%>

</table>
</div>
</body>
</html>
 
HAPPY HAPPY HAPPY DANCE TIME. IT WAS THE EXTRA SPACE. THANKS SO MUCH TO ALL OF YOU!!!!!!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top