Hi,
I am getting this error:
Command text was not set for the command object.
/projects/Maintenance/search_results.asp, line 42
<b>Can someone tell what is wrong</b>
<b>Here is my code:</b>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/rs.asp" -->
<%
Dim rs__SEARCH
rs__SEARCH = "b"
If (REQUEST.FORM("txtSearch") <> "") Then
rs__SEARCH = REQUEST.FORM("txtSearch")
End If
%>
<%
Dim rs, strUnit, strType, strSearchCode
Dim rs_numRows
strUnit = Request.Form("txtUnit")
strType = Request.Form("txtType")
strSearchCode = strUnit + strType
response.write strSearchCode
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_rs_STRING
Select Case strSearchCode
Case "11"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE Equipment LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY Equipment ASC"
Case "12"
rs__SEARCH = Right(REQUEST.FORM("txtSearch"),5)
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE EquipmentNbr LIKE '%" + Replace(rs__SEARCH, "'", "") + "%' ORDER BY EquipmentNbr ASC"
Case "13"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE Lubricants LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY Lubricants ASC"
Case "14"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE IdentifierColor LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY IdentifierColor ASC"
Case "15"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE CtrlNbr LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY CtrlNbr ASC"
Case "16"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE IdentifierName LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY IdentifierName ASC"
Case Else
Response.write "You must select your search parameters."
End Select
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()
<b>Here is the connection string:</b>
Dim MM_rs_STRING
MM_rs_STRING = "driver=SQL Server;SERVER=SEIMS;DATABASE=FORMS;UID=forms;PWD=forms;
I am getting this error:
Command text was not set for the command object.
/projects/Maintenance/search_results.asp, line 42
<b>Can someone tell what is wrong</b>
<b>Here is my code:</b>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/rs.asp" -->
<%
Dim rs__SEARCH
rs__SEARCH = "b"
If (REQUEST.FORM("txtSearch") <> "") Then
rs__SEARCH = REQUEST.FORM("txtSearch")
End If
%>
<%
Dim rs, strUnit, strType, strSearchCode
Dim rs_numRows
strUnit = Request.Form("txtUnit")
strType = Request.Form("txtType")
strSearchCode = strUnit + strType
response.write strSearchCode
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_rs_STRING
Select Case strSearchCode
Case "11"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE Equipment LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY Equipment ASC"
Case "12"
rs__SEARCH = Right(REQUEST.FORM("txtSearch"),5)
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE EquipmentNbr LIKE '%" + Replace(rs__SEARCH, "'", "") + "%' ORDER BY EquipmentNbr ASC"
Case "13"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE Lubricants LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY Lubricants ASC"
Case "14"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE IdentifierColor LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY IdentifierColor ASC"
Case "15"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE CtrlNbr LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY CtrlNbr ASC"
Case "16"
rs.Source = "SELECT * FROM dbo.vw_Lubrications WHERE IdentifierName LIKE '%" + Replace(rs__SEARCH, "'", "''") + "%' ORDER BY IdentifierName ASC"
Case Else
Response.write "You must select your search parameters."
End Select
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()
<b>Here is the connection string:</b>
Dim MM_rs_STRING
MM_rs_STRING = "driver=SQL Server;SERVER=SEIMS;DATABASE=FORMS;UID=forms;PWD=forms;