[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

ADODB.Recordset error '800a0bb9'

I am getting the following error.  I am writing this in ASP. Using an Access Database 2000.

ADODB.Recordset error '800a0bb9'

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

/employees_new.asp, line 41

Here is the SQL
SELECT [EMP_LAST_NAME] & ', ' & [EMP_FIRST_NAME] AS NAME, EMPLOYEES.EMP_LAST_NAME, EMPLOYEES.EMP_FIRST_NAME, EMPLOYEES.EMP_NUMBER, EMPLOYEES.EMP_COST_CENTER, [COST CENTERS].CST_DEPARTMENT, EMPLOYEES.EMP_VIRTUAL_EXT, EMPLOYEES.EMP_EXT, Mid([EMP_PHONE],1,10) AS PHONE, Mid([EMP_PAGER],1,10) AS PAGER, EMPLOYEES.EMP_ALPHA, [COST CENTERS].CST_MAIN_COST_CENTER FROM EMPLOYEES LEFT JOIN [COST CENTERS] ON EMPLOYEES.EMP_COST_CENTER = [COST CENTERS].CST_COST_CENTER WHERE EMPLOYEES.EMP_TERMINATED=0 AND EMP_LAST_NAME Like "%Smith%"ORDER BY [EMP_LAST_NAME], [EMP_FIRST_NAME]

I have the Code below and the error is coming up an the line second to the end.  Anyone have any idea what I need to do.  

Web Server - W2K Server/IIS 5.0/IE 6.0

Thank you,
Rodger



<%@ Language=VBScript %>
 
<% Option Explicit %>
<% Response.Buffer = true %>
 
 
<% dim conn, rs, rs2, rs3, rs4, strSql, strNumber, strCount, strBackColor, strPage, strDepartments, myArea, strRelated, strAll, strSub
	dim getName, getDepartment, myPhone, getDepartment1
	getName = ""
	getDepartment = ""
	
	getName = Request("myName")
	getDepartment = Request("myDepartment")
 
	conn = "Provider=MS Remote;Remote Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\intranet\data\EmployeeExtUpdate.mdb;Remote Server=http://websrv3"
	
                Set rs = CreateObject("ADOR.Recordset")
	Set rs2 = CreateObject("ADOR.Recordset")
 
	'CHECK TO SEE IF NAME IS BLANK
		if(isempty(getName)) or getName = "" then
			strSql = "SELECT [EMP_LAST_NAME] & ', ' & [EMP_FIRST_NAME] AS NAME, EMPLOYEES.EMP_LAST_NAME, EMPLOYEES.EMP_FIRST_NAME, EMPLOYEES.EMP_NUMBER, EMPLOYEES.EMP_COST_CENTER, [COST CENTERS].CST_DEPARTMENT, EMPLOYEES.EMP_VIRTUAL_EXT, EMPLOYEES.EMP_EXT, Mid([EMP_PHONE],1,10) AS PHONE, Mid([EMP_PAGER],1,10) AS PAGER, EMPLOYEES.EMP_ALPHA, [COST CENTERS].CST_MAIN_COST_CENTER " & _
                     "FROM EMPLOYEES LEFT JOIN [COST CENTERS] ON EMPLOYEES.EMP_COST_CENTER = [COST CENTERS].CST_COST_CENTER " & _
                     "WHERE EMPLOYEES.EMP_TERMINATED=0 AND CST_MAIN_COST_CENTER=" & getDepartment & " " & _
                     "ORDER BY [EMP_LAST_NAME], [EMP_FIRST_NAME]"
			strSub = "SELECT * FROM [COST CENTERS] WHERE CST_MAIN_COST_CENTER=" & getDepartment & " ORDER BY CST_DEPARTMENT"	
			SESSION("display") = "SECOND"
		end if	
	
	'CHECK TO SEE IF DEPARTMENT IS BLANK
		if(isempty(getDepartment)) or getDepartment = "" then
			strSql = "SELECT [EMP_LAST_NAME] & ', ' & [EMP_FIRST_NAME] AS NAME, EMPLOYEES.EMP_LAST_NAME, EMPLOYEES.EMP_FIRST_NAME, EMPLOYEES.EMP_NUMBER, EMPLOYEES.EMP_COST_CENTER, [COST CENTERS].CST_DEPARTMENT, EMPLOYEES.EMP_VIRTUAL_EXT, EMPLOYEES.EMP_EXT, Mid([EMP_PHONE],1,10) AS PHONE, Mid([EMP_PAGER],1,10) AS PAGER, EMPLOYEES.EMP_ALPHA, [COST CENTERS].CST_MAIN_COST_CENTER " & _
                     "FROM EMPLOYEES LEFT JOIN [COST CENTERS] ON EMPLOYEES.EMP_COST_CENTER = [COST CENTERS].CST_COST_CENTER " & _
                     "WHERE EMPLOYEES.EMP_TERMINATED=0 AND EMP_LAST_NAME Like " & chr(34) & "%" & getName & "%" & Chr(34) & _
                     "ORDER BY [EMP_LAST_NAME], [EMP_FIRST_NAME]"
			
			'strSql = "SELECT * FROM qry_List WHERE NAME Like '%" & getName & "%' ORDER BY NAME"
			SESSION("display") = "SECOND"
		end if
 
	rs.Open strSql, conn, 3, 4    <<<<<This is the line I am getting hte Error >>>>>
	rs2.Open strDepartments, conn,  3, 4

Open in new window

0
Rodger
Asked:
Rodger
1 Solution
 
BrandonGalderisiCommented:
You don't open a recordset using a connectionstring, you open it with a connection.  CONN is your connection string.

 rs.Open strSql, conn

You would need something like this.


<%@ Language=VBScript %>
 
<% Option Explicit %>
<% Response.Buffer = true %>
 
 
<% dim conn, rs, rs2, rs3, rs4, strSql, strNumber, strCount, strBackColor, strPage, strDepartments, myArea, strRelated, strAll, strSub
        dim getName, getDepartment, myPhone, getDepartment1
        getName = ""
        getDepartment = ""
        
        getName = Request("myName")
        getDepartment = Request("myDepartment")
        set conn = createobject("ador.connection")
conn.connectionstring = "Provider=MS Remote;Remote Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\intranet\data\EmployeeExtUpdate.mdb;Remote Server=http://websrv3"
        
                Set rs = CreateObject("ADOR.Recordset")
        Set rs2 = CreateObject("ADOR.Recordset")
 
        'CHECK TO SEE IF NAME IS BLANK
                if(isempty(getName)) or getName = "" then
                        strSql = "SELECT [EMP_LAST_NAME] & ', ' & [EMP_FIRST_NAME] AS NAME, EMPLOYEES.EMP_LAST_NAME, EMPLOYEES.EMP_FIRST_NAME, EMPLOYEES.EMP_NUMBER, EMPLOYEES.EMP_COST_CENTER, [COST CENTERS].CST_DEPARTMENT, EMPLOYEES.EMP_VIRTUAL_EXT, EMPLOYEES.EMP_EXT, Mid([EMP_PHONE],1,10) AS PHONE, Mid([EMP_PAGER],1,10) AS PAGER, EMPLOYEES.EMP_ALPHA, [COST CENTERS].CST_MAIN_COST_CENTER " & _
                     "FROM EMPLOYEES LEFT JOIN [COST CENTERS] ON EMPLOYEES.EMP_COST_CENTER = [COST CENTERS].CST_COST_CENTER " & _
                     "WHERE EMPLOYEES.EMP_TERMINATED=0 AND CST_MAIN_COST_CENTER=" & getDepartment & " " & _
                     "ORDER BY [EMP_LAST_NAME], [EMP_FIRST_NAME]"
                        strSub = "SELECT * FROM [COST CENTERS] WHERE CST_MAIN_COST_CENTER=" & getDepartment & " ORDER BY CST_DEPARTMENT"        
                        SESSION("display") = "SECOND"
                end if  
        
        'CHECK TO SEE IF DEPARTMENT IS BLANK
                if(isempty(getDepartment)) or getDepartment = "" then
                        strSql = "SELECT [EMP_LAST_NAME] & ', ' & [EMP_FIRST_NAME] AS NAME, EMPLOYEES.EMP_LAST_NAME, EMPLOYEES.EMP_FIRST_NAME, EMPLOYEES.EMP_NUMBER, EMPLOYEES.EMP_COST_CENTER, [COST CENTERS].CST_DEPARTMENT, EMPLOYEES.EMP_VIRTUAL_EXT, EMPLOYEES.EMP_EXT, Mid([EMP_PHONE],1,10) AS PHONE, Mid([EMP_PAGER],1,10) AS PAGER, EMPLOYEES.EMP_ALPHA, [COST CENTERS].CST_MAIN_COST_CENTER " & _
                     "FROM EMPLOYEES LEFT JOIN [COST CENTERS] ON EMPLOYEES.EMP_COST_CENTER = [COST CENTERS].CST_COST_CENTER " & _
                     "WHERE EMPLOYEES.EMP_TERMINATED=0 AND EMP_LAST_NAME Like " & chr(34) & "%" & getName & "%" & Chr(34) & _
                     "ORDER BY [EMP_LAST_NAME], [EMP_FIRST_NAME]"
                        
                        'strSql = "SELECT * FROM qry_List WHERE NAME Like '%" & getName & "%' ORDER BY NAME"
                        SESSION("display") = "SECOND"
                end if
 
        rs.Open strSql, conn, 3, 4    <<<<<This is the line I am getting hte Error >>>>>
        rs2.Open strDepartments, conn,  3, 4

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now