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!

ADO cmd Access2K & stored procedure

Status
Not open for further replies.

mylesorme

Programmer
Feb 10, 2002
2
0
0
US
I have an application written in Access2k that makes extensive use of stored procedures (ok, paramaterised queries) controlled by a VB script that is essentially a series of ADO command objects of type adStoredProc.

It works very well in native Access, but not in asp.

I am told that the arguments are out of range or in conflict on the line: adoCmd.CommandType=adStoredProcedure and again on the parameter object type.

2 questions then:

The first and most important is does ASP allow stored procedures in Access2K? can anyone see what is wrong with the code below - this example is trivial and could be done with a rs object but I want to use stored procedures for later scaling to SQL Server & just because.

3 - does char have to have a size, and is it the equivalent of a text type in access?

<%
strCon = &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=&quot; & Server.MapPath(&quot;dbMyData.mdb&quot;)

'DSN connection (alternative)
'strCon=&quot;dsn=dsnMyAccess2kData&quot;

'Set an active connection to the Connection object
adoCon.Open strCon

'Capture some form fields, but we'll just set some variables up for now
Dim strUserName, strEmail
strUserName = &quot;John&quot;
strEmail = &quot;john@smith.name&quot;

Set adoCmd = Server.CreateObject(&quot;ADODB.Command&quot;)
adoCmd.ActiveConnection = adoCon
adoCmd.CommandText = &quot;qryMemberAddNew&quot;
adoCmd.CommandType = adCmdStoredProc

' set up the parameter objects to pass the data to the stored procedure
Set prmUserName = Server.CreateObject(&quot;ADODB.Parameter&quot;)
prmUserName.Name = &quot;strUserName&quot;
prmUserName.Type=adChar
prmUserName.Direction=adParamInput
prmUserName.Value = strFirstName

'I've even tried different methods!
Set prmEmail = adoCmd.CreateParameter
prmEmail.Name = &quot;strEmail&quot;
prmEmail.Type = adChar
prmEmail.Direction = adParamInput
prmEmail.Value = strFirstName
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top