calling tables

Results 1 to 2 of 2

Thread: calling tables

  1. #1
    Join Date
    Dec 1969

    Default calling tables

    OK folks, i have an html page where I can select one of four options, boys, girls, men, women. There are 4 tables in a database witht the same name, boys, girls, women, men. As of know, the boys sections is working and when it is selected, an ASP page is called that selects names and images from a database. The SQL for the boys page is as follows:<BR> Dim strSQL<BR> strSQL = "SELECT * FROM Boys ORDER BY lname,name"<BR>Now i would like this to happen, when i select a link fom the html page, i would like the asp page to know, based on the section(boys, girls, men, women) i pick, which table to look from. How is this accomplished?? I have tried code like this, but i am sure this is not right.<BR> Dim CurPage, Table<BR> If Request.QueryString("CurPage") = "" then<BR> CurPage = 1 &#039We&#039re on the first page<BR> Else<BR> CurPage = Request.QueryString("CurPage")<BR> End If<BR> Table = Request.QueryString("Table")<BR> <BR> Dim Connect<BR> Set Connect = Server.CreateObject("ADODB.Connection")<BR> Connect.Open "Heyman"<BR><BR> &#039Explicitly Create a recordset object<BR> Dim rs<BR> Set rs = Server.CreateObject("ADODB.Recordset")<BR> <BR> &#039Set the cursor location property<BR> rs.CursorLocation = adUseClient<BR> <BR> &#039Set the cache size = to the # of records/page<BR> rs.CacheSize = NumPerPage<BR><BR> &#039Open our recordset<BR> Dim strSQL<BR> strSQL = "SELECT * FROM " & Table & " ORDER BY lname,name"<BR> rs.Open strSQL, Connectrs.Open strSQL, Connect<BR><BR>This is only part of the code, but it is the guts of what i am doing. Anyway, any help would be appreciated.<BR><BR>thanks<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: calling tables

    On the first page, if the "selections" are Hyperlinks, you could do something like the following<BR><BR>&#060;A HREF=&#039secondpage.asp?Table=Boys&#039&#062;Boys &#060;/A&#062;<BR><BR>Then the code you have above for the second page will work just fine.<BR><BR>If they (selections) are a drop down list, make sure the selection is named &#039Table&#039 and the form is using a GET method. Then the code you have for the second page will work.<BR><BR>HTH<BR><BR>Jerry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts