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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable record set

Status
Not open for further replies.

taoist

Programmer
Joined
Feb 1, 2006
Messages
35
Location
US
I have a value in my variable --- myvar1

but when I run the query for some reason I get to results
and I know there is data in the database.

to make sure myvar1 is carrying
data I did a response.write and I get something on the screen. So the variable is fine

any help on this would be greatly appreciated

Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("myvar1") <> "") Then
Recordset1__MMColParam = Request.QueryString("myvar1")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_Helpdeskcnn_STRING
Recordset1.Source = "SELECT * FROM dbo.task WHERE first = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
response.write Recordset1__MMColParam
%>
 
I get no results
 
I would do a "select * from dbo.task" and output that to the page just to test the connection, then try changing your recordset to include the line in red below

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_Helpdeskcnn_STRING
Recordset1.Source = "SELECT * FROM dbo.task WHERE first = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Response.write(Recordset1.Source)
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

This will show you exactly what your select statement is trying to get


[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top