ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old September 17th, 2003, 04:51 PM
Moses912 Moses912 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 4 Moses912 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Passing recordset value to a query

Please Help!!!!!

I've been trying to figure this out for a couple of days to no avail.

I'm trying to pass a value that I get from one database query (stored in the recordset. To another database query, and I'm getting an error stating that there is a type mismatch. Here is the code. Specifically I'm trying to pass the value of ThreadID that I get from the first query (always returns a single value) storing it in a variabel called ThreadReply, and then using that variable in my second query statement.

set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT ThreadID FROM TblForumThread WHERE ThreadName='"&Session("ThreadName")&"';"
rs.Open sql, conn
ThreadReply=rs("ThreadID")
rs.Close
set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM TblForumReply WHERE ThreadID='"&ThreadReply&"';"
rs.Open sql, conn

Please Help.

Reply With Quote
  #2  
Old September 17th, 2003, 06:01 PM
mrusaw's Avatar
mrusaw mrusaw is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Dallas, Texas
Posts: 138 mrusaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to mrusaw Send a message via Yahoo to mrusaw
try it this way and see if if helps. i had this same problem a long time ago but i am not sure if this was right for a fix or not :

Code:
sql = "SELECT * FROM TblForumReply WHERE ThreadID='" & CStr(ThreadReply) & "';" 
__________________
mr...

mike.rusaw@realpage.com
RalPage, Inc.

"I have made this letter longer than usual, only because I have not had the time to make it shorter." - Blaise Paschal

Reply With Quote
  #3  
Old September 18th, 2003, 12:19 AM
Moses912 Moses912 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 4 Moses912 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank You
for your quick response. Unfortunately it did not work, is there anything else that I can try.

Thanx

Reply With Quote
  #4  
Old September 18th, 2003, 12:34 AM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 8
if ThreadID is a numeric field in the database then do not enclose the value in single quotes.
__________________
Programmer's Corner

Reply With Quote
  #5  
Old September 18th, 2003, 02:27 AM
Moses912 Moses912 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 4 Moses912 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That worked!!!

Thank You very much

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Passing recordset value to a query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway