If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > no records are displayed?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-17-04, 18:45
-Dman100- -Dman100- is offline
Registered User
 
Join Date: Jan 2004
Posts: 124
no records are displayed?

I'm using a search function, but no records are displaying from the search. Are there problems with SQL statements?

Here is the code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/DBConn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtKeywords") <> "") Then
Recordset1__MMColParam = Request.Form("txtKeywords")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_DBConn_STRING
strTest = Request.Form("selMatchType")
Select Case strTest
Case Exact
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Case Ending
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Case Contain
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Case Begin
Case Else Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
End Select
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><%=(Recordset1.Fields.Item("id").Value)%></td>
<td><%=(Recordset1.Fields.Item("prod_number").Valu e)%></td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Reply With Quote
  #2 (permalink)  
Old 07-19-04, 12:56
rguy84 rguy84 is offline
Registered User
 
Join Date: Jun 2004
Location: Seattle, WA
Posts: 601
You are just getting the field titles to me?
__________________
Ryan
My Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On