SQL Server Performance

same server but different database(URGENT)

Discussion in 'General Developer Questions' started by heyhey84, Sep 1, 2003.

  1. heyhey84 New Member

    Below is the code i tried but is unable to work. When the user choose one of the country, it will go to that database which is under the same server. Can anyone help?<br /><br />&lt<img src='/community/emoticons/emotion-4.gif' alt=';p' />&gt;&lt;b&gt;Select: <br /> &lt;select name="country"&gt;<br /> &lt;option value ="singapore" &gt;Singapore&lt;/option&gt;<br /> &lt;option value ="malaysia"&gt;Malaysia&lt;/option&gt;<br /> &lt;option value ="china"&gt;China&lt;/option&gt;<br /> &lt;/select&gt;<br /> &lt;/p&gt;<br /> &lt;script type="text/vbscript"&gt; <br />select case OPTION<br />case "singapore"<br /> set objConn2.ConnectionString = "dsn=a;uid=sa<img src='/community/emoticons/emotion-4.gif' alt=';p' />wd=sa;"<br />case "malaysia"<br /> set objConn2.ConnectionString = "dsn=b;uid=sa<img src='/community/emoticons/emotion-4.gif' alt=';p' />wd=sa;"<br />case else<br />end select <br />&lt;/script&gt;<br /> &lt;/b&gt;
  2. satya Moderator

    What was the error you're getting?
    (moved to Developer forum)

    _________
    Satya SKJ
    Moderator
    SQL-Server-Performance.Com
  3. heyhey84 New Member

    The page can display but is still using the database. The information display is the same.
  4. satya Moderator

    Sorry, I couldn't understand what you require.
    Any error or information displayed from the webpage?

    _________
    Satya SKJ
    Moderator
    SQL-Server-Performance.Com
  5. Argyle New Member

    Test with a DSN-less connection instead to see if it's a missconfigured DSN.<br /><br />Example:<br />"Driver={SQL Server};Server=ServerX;Database=singapore;Uid=sa<img src='/community/emoticons/emotion-4.gif' alt=';P' />wd=sa;"<br />"Driver={SQL Server};Server=ServerX;Database=malaysia;Uid=sa<img src='/community/emoticons/emotion-4.gif' alt=';P' />wd=sa;"<br /><br />/Argyle
  6. heyhey84 New Member

    It just display done,but with errors on page. Singapore and malaysia database are in the same server. When the user choose singapore, it will go to that database instead of malaysia... What should i do?
  7. heyhey84 New Member

    What if i change another method... I change the option value to the data source name as they are using the same server. Then i write the coding on the other page.<br /><br />Set objConn = Server.CreateObject("ADODB.Connection")<br />objConn.Open "datasource=Request.Form("datasource");uid=sa<img src='/community/emoticons/emotion-4.gif' alt=';p' />wd=sa;"<br /><br />But there are some error.<br /><br />Expected end of statement<br />objConn.Open = "dsn=Request.Form<br />("dsn");uid=dba<img src='/community/emoticons/emotion-4.gif' alt=';p' />wd=dbasql;"<br />--------------------------------^<br /><br />Why is there error??
  8. Twan New Member

    Shoulnd't the Request.Form be concatenated in?<br /><br />something like<br />objConn.Open "datasource=" + Request.Form("datasource") + ";uid=sa<img src='/community/emoticons/emotion-4.gif' alt=';p' />wd=sa;"<br /><br />Cheers<br />Twan<br /><br />In production ready code, the datasource value should be validated to make sure that you don't have people fiddling with the query string...

Share This Page