By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

SQL error "Arguments are of the wrong type ..."

P: n/a
Hi

I have a web page which receives information from a form (using
request.form) and also attempts to look at an Access query to read in
recoeds to a variable named rsGroup.

When I have the following line commented, so it does not activate, I
can successfully print all of the response.write's below:

rsGroup.Open strSQL, adoCon

response.write(strSQL)
response.write("<P>")
response.write(GroupSend)
response.write("<P>")
response.write(request.form("GroupName"))
response.write("<P>")
response.write(" " & request.form("Subject"))
response.write("<P>")
response.write(" " & request.form("Content"))

response.write(strSQL) prints as:
SELECT qrySendemail*GroupName FROM qrySendemail WHERE GroupName =
'FOOTBALL'
and works fine if I use it directly in an access query

However when I uncomment

rsGroup.Open strSQL, adoCon

I get the following error message

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

You will see I have several alternative SQL's (currently
commented)which I have tried, all work OK when rsGroup.Open strSQL,
adoCon is commented.

I have several other pages using similar ado connections and generally
similar code, which work OK.

Any advice would be appreciated

Note - I do realise I am querying an access query not a table; I will
not be updating or deleting records in the query.

Thanks ColinK

Code:

<%@ Language=VBScript %>

<%
'Dimension variables
Dim objDC 'Holds the Database Connection Object
Dim strSQL 'Holds the SQL query to query the database
Dim rsGroup 'Holds the details of group members
Dim GroupSend 'holds the group name to send to

'insert the Group name to send to into the variable GroupSend
GroupSend = (Request.Form("GroupName"))

'Create an ADO connection object on the server using the ADO Database
connection object
Set objDC = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a ****
DSN-less connection ****
objDC.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("../databases/GC1.mdb")

'Create an ADO recordset object
Set rsGroup = Server.CreateObject("ADODB.Recordset")

' request record for requested Groupid

'NOTE first 2 sql's are currently commented
'strSQL = "SELECT * FROM qrySendemail WHERE GroupName = '" &
Request.Form("GroupName") &"' "
'strSQL = "SELECT * FROM qrySendemail WHERE GroupName = 'FOOTBALL' "
strSQL = "SELECT qrySendemail*GroupName FROM qrySendemail WHERE
GroupName = 'FOOTBALL' "
'Set the cursor type we are using so we can navigate through the
recordset
rsGroup.CursorType = 2

'Open the recordset with the SQL query
'rsGroup.Open strSQL, adoCon
'rsGroup.Close

response.write(strSQL)
response.write("<P>")
response.write(GroupSend)
response.write("<P>")
response.write(request.form("GroupName"))
response.write("<P>")
response.write(" " & request.form("Subject"))
response.write("<P>")
response.write(" " & request.form("Content"))
%>

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ia****@gmail.com wrote:
However when I uncomment

rsGroup.Open strSQL, adoCon

I get the following error message

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

You will see I have several alternative SQL's (currently
commented)which I have tried, all work OK when rsGroup.Open strSQL,
adoCon is commented.

I have several other pages using similar ado connections and generally
similar code, which work OK.


The first thing I'd look at would be the reference to ADO or the
inclusion of adovbs.inc but not both as they tend to conflict one
another sometimes.

Then look at the type of recordset you are opening as you don't specify
one in that line of code.

--
[OO=00=OO]
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.