cfcProgrammer
Programmer
Hi
Could someone please help me figure out what my error is in this code. I am new to this and am unsure what it is that's causing me issues.
Here is a copy of the connection code.
The error message I am receiving is:
"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/DFOReps/FishStatusReport.asp, line 12"
Line 12 would be "MyRecordSet.CursorLocation = adUseClient"
Any help or guidance would be greatly appreciated.
Thank You
Colleen
cfcProgrammer
Could someone please help me figure out what my error is in this code. I am new to this and am unsure what it is that's causing me issues.
Here is a copy of the connection code.
Code:
<%@ Language=VBScript %>
<% ' VI 6.0 Scripting Object Model Enabled %>
<!-- #include file="../_ScriptLibrary/pm.asp" -->
<% if StartPageProcessing() Then Response.End() %>
'Create database connection
<%
dim strConnection, objConnection, objCommand, MyRecordSet, strStoredSQL
Set objConnection = Server.CreateObject("ADODB.Connection")
Set objCommand = Server.CreateObject("ADODB.Command")
Set MyRecordSet = Server.CreateObject("ADODB.Recordset")
MyRecordSet.CursorLocation = adUseClient
strConnection = "Provider=SQLOLEDB; Data Source=MyDataSource; Initial Catalog=MyInitialCat; UId=uid; Pwd=pwd;"
set MyConn = Server.CreateObject("ADODB.Connection")
' The following line must be changed to reflect your data source info
MyConn.open "PROVIDER=SQLOLEDB;DRIVER={SQL Server};SERVER=myserver;DATABASE=mydatabase;UID=uid;PWD=pwd;"
set MyCmd = server.createObject("ADODB.command")
set MyCmd.activeConnection = Myconn
' Specify the name of the stored procedure you wish to call
MyCmd.commandText = "FishStatusReportByArea"
MyCmd.commandType = adCmdStoredProc
'Define parameters and get the values to pass to the stored procedure
dim Region: Region = GetRegion()
dim Sort: Sort = Request.form("sort")
dim FromDate: FromDate = Request.form("txtFromDay") + "/" + Request.form("txtFromMonth") + "/" + request.form("txtFromYear")
dim ToDate: ToDate = Request.form("txtToDay") + "/" + Request.form("txtToMonth") + "/" + Request.form("txtToYear")
' Create the parameters for the Stored Procedure
Mycmd.Parameters.Append Mycmd.CreateParameter("@Region",adVarChar,adParamInput,30,Region)
Mycmd.Parameters.Append Mycmd.CreateParameter("@FromDate",adDate,adParamInput,10,FromDate)
Mycmd.Parameters.Append Mycmd.CreateParameter("@ToDate",adDate,adParamInput,10,ToDate)
Mycmd.Parameters.Append Mycmd.CreateParameter("@Sort",advarChar,adParamInput,5,Sort)
'Call Stored Proc
objConnection.open strConnection
set MyRecordSet = Mycmd.execute
'check the return value to see if there are any records returned
if NOT (MyRecordSet.BOF or MyRecordSet.EOF) then
'Retreive the data from the stored proc results'
repArrRS = MyRecordSet.getrows()
totrecs = ubound(repArrRS,2)
dim repRow 'Row Counter
repRow = 0
AreRecs = true 'there are records
else
totrecs = 0
AreRecs = false 'there are no records
end if
MyRecordSet.close() 'close the recordset
set MyRecordSet = Nothing
"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/DFOReps/FishStatusReport.asp, line 12"
Line 12 would be "MyRecordSet.CursorLocation = adUseClient"
Any help or guidance would be greatly appreciated.
Thank You
Colleen
cfcProgrammer