Login | |
|
 |
RE: Response Write - Recordsets - 4/3/2007 4:23:38 AM
|
|
 |
|
| |
Country73
Posts: 710
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
So basically your connecting to one database that has the individuals name in one column followed by the courses they have enrolled in. The classes they have enrolled in are designated by a number that ties into another database, by number, which lists the course name? DB1 - UserName, 1, 2, etc... DB2 - 1 = Course Name 2 = Course Name etc... How is the name passed through your script? In the first database you will need to go through each recordset until the name matches up with the name you have passed to the script. If the name matches, you will then take the number (associated with the class) and go through each ID in the second database until it matches the number you passed from the first DB. So this doesn't get too confusing, can you supply a little bit more of your code?
|
|
| |
|
|
|
 |
RE: Response Write - Recordsets - 4/3/2007 10:48:28 PM
|
|
 |
|
| |
JBarbea1
Posts: 20
Score: 0
Joined: 3/27/2007
Status: offline
|
Hey Country, thanks for the response. You are correct in your analysis! A litte more background: I am getting the "Name" I am looking for, or the student I am looking for by passing the _ID via "Request.QueryString("String"), so that recordset is working fine. (I've since change the Query.String to a Session Variable so that users cant manipulate the URL. I guess I could also pass the Course_ID, but I have roughly 6 ID that would have to be passed. How do I "go through each ID in the second database (table in my case) until it matches the number you passed from the first DB"? Im working from One Database, just different tables, using 2 recordsets. The recordsets are filled based based on the Students ID, and the Course recordset is filled with ALL the courses I have available. Im not positive that I have any other code to supply that would help, I have the two recordsets, i just need to know how to do what you said above. "Go through each ID of the second recordset, when the ID matches, Reponse.Write the course name" <% ' Course Recordset for Continuing Education Units (CEU) Dim rsCourses Dim rsCourses_cmd Dim rsCourses_numRows Set rsCourses_cmd = Server.CreateObject ("ADODB.Command") rsCourses_cmd.ActiveConnection = MM_HCI_STRING rsCourses_cmd.CommandText = "SELECT CEDU_Course_ID, Course_Name, Course_Date, Department, Course_Cost FROM xxx.CEDU_COURSES WHERE Course_Date > GetDate()" rsCourses_cmd.Prepared = true Set rsCourses = rsCourses_cmd.Execute rsCourses_numRows = 0 %> Hope this helps a little, I could sure use the help. As I've said, little new to VBScript, but my confidence grows each day!
|
|
| |
|
|
|
 |
RE: Response Write - Recordsets - 4/4/2007 2:59:07 AM
|
|
 |
|
| |
Country73
Posts: 710
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
Alright, I'm going to take a stab at this, but just so you know it has been a while since I have messed with this. Here is a sight that I reference whenever I have to get back into any SQL Queries: http://www.w3schools.com/sql/sql_intro.asp (Which may be able to assist you more than what I can do) Here's my attempt. When you connect to your first table, you are able to extract the student "Name", are you also able to extract the course numbers for that individuals "Name"? I'm assuming that your table looks something like this: Recordset1 ID C1 Enr C1 Enr C1 Enr "Name" 1 2 3 For the classes the individual is enrolled in, do they all have the same title or are they more like "C1 Enr", "C2 Enr", "C3 Enr" etc... ? Once you locate the "Name", set a variable for each course that individual has taken. Use those variables to query Recordset2, the same way you queried the "Name" in your first table.
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|