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

Error - Arguments of wrong type or out of range? HELP!

Status
Not open for further replies.

selaine

Programmer
Oct 11, 2001
85
0
0
US
I'm getting the following error: I need to insert a record into one table, grab the autonumber key (Register_ID)and insert multiple records into another table with the key. Does anyone know why I'm getting this error and how I can correct it?

ADODB.Connection error '800a0bb9'

The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

/Check2/submit_registration.asp, line 44

Line 44 is:
connupdate.Open "WebRegister", strProvider, adOpenKeySet, adLockPessimistic

Here is my code:
<% Option Explicit %>

<!-- #include file=&quot;adovbs.inc&quot; -->

<% Response.buffer = True%>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>

<%
Dim aCatIds, _
aSubCatIds
Dim iGroupId, _
iCntCatId, _
iCntSubCatId, _
iSubCatId, _
iRegisterId
Dim strNotify
Dim sFld, _
sSql
Dim strProvider
Dim connupdate

sSql = &quot;INSERT INTO Webregister (Company_Name, St_Address, City, State, Zip, Phone_Num, Fax_Num, Web_Site, Contact_Person, Contact_Phone, Contact_Email, Respond_Da, E_Notify) Values ('&quot; & Replace(Request.Form(&quot;D_Company&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Address&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_City&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_State&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Zip&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Phone&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Fax&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Website&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Contact&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_CPhone&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;D_Email&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Replace(Request.Form(&quot;hidDate&quot;), &quot;'&quot;, &quot;&quot;) & &quot;','&quot; & Request.Form(&quot;notify&quot;) & &quot;')&quot;

set connupdate = server.createobject(&quot;ADODB.Connection&quot;)
strProvider=&quot;Provider=MSDASQL.1;Persist Security Info=False;Data Source=Registration&quot;
connupdate.Open &quot;WebRegister&quot;, strProvider, adOpenKeySet, adLockPessimistic

connupdate.execute(sSql)

'execute SQL statement, get newly created RegisterId
iRegisterID = connupdate(&quot;Register_ID&quot;)

aCatIds = Split(Request.Form(&quot;GroupID&quot;), &quot;, &quot;)
For iCntCatId = 0 To UBound(aCatIds)
iGroupId = aCatIds(iCntCatId)

aSubCatIds = Split(Request.Form(&quot;SubCatId_&quot; & iGroupId), &quot;, &quot;)
For iCntSubCatId = 0 To UBound(aSubCatIds)
iSubCatId = aSubCatIds(iCntSubCatId)

sSql = &quot;INSERT INTO WebCommodities (Register_ID, GroupID, SubCategory) Values(&quot; & vbCrLf & _
&quot; &quot; & iRegisterId & &quot;,&quot; & vbCrLf & _
&quot; &quot; & iGroupId & &quot;,&quot; & vbCrLf & _
&quot; &quot; & iSubCatId & vbCrLf & _
&quot;)&quot;

connupdate.execute(sSql)
Next
Next

connupdate.close
set connupdate = nothing

%>

</BODY>
</HTML>
 


connupdate.Open strProvider, strProvider, adOpenKeySet, adLockPessimistic






Chris.

Indifference will be the downfall of mankind, but who cares?
 
DOH! Ignore above post.

Back when brain working



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top