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 /><<img src='/community/emoticons/emotion-4.gif' alt=';p' />><b>Select: <br /> <select name="country"><br /> <option value ="singapore" >Singapore</option><br /> <option value ="malaysia">Malaysia</option><br /> <option value ="china">China</option><br /> </select><br /> </p><br /> <script type="text/vbscript"> <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 /></script><br /> </b>
What was the error you're getting? (moved to Developer forum) _________ Satya SKJ Moderator SQL-Server-Performance.Com
Sorry, I couldn't understand what you require. Any error or information displayed from the webpage? _________ Satya SKJ Moderator SQL-Server-Performance.Com
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
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?
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??
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...