I have been using ASP for a long time now, never had this come up before. We are using godaddy hosting with an MSSQL 2005 db. My connection string that I use locally on our servers and on many other company servers works great, but on godaddy doesnt work worth a darn. so after about 5 hours on tech support., they give me this code to work with. Wierd thing about it is, if I send the data through the form as far as db,pw,server info etc. it works fine, but I cant hard code it. I need to be able to have this working hard coded since it is included in a file on each page of the site.. What am I not doing? Is the form sending something different than if I were to just code in the details?? Im totally lost. any ideas??? please help. Thanks in advance! here is the code they provided me to work with. ============ <h3>ASP - MSSQL Connection Test Script</h3> Enter the database information below to test connecting to that database from this hosting account.<br /><br /> <FORM METHOD="POST" ACTION="mssql.asp"> <table> <tr><td>User:</td><td><INPUT TYPE="text" id="UID" name="UID" /></td></tr> <tr><td>Pass:</td><td><INPUT TYPE="text" id="PWD" name="PWD" /></td></tr> <tr><td>DB:</td><td><INPUT TYPE="text" id="DB" name="DB" /></td></tr> <tr><td>Server:</td><td><INPUT TYPE="text" id="SERV" name="SERV" /></td></tr> <tr><td></td><td><INPUT TYPE="submit" id="submit" name="submit"></td></tr> </table> </FORM> <% if Request.Form("submit") <> "" Then dim Conn dim DSN dim UID dim PWD dim DB dim SERV UID=Request.Form("UID") PWD=Request.Form("PWD") DB=Request.Form("DB") SERV=Request.Form("SERV") Set Conn = Server.CreateObject("ADODB.Connection") DSN="DRIVER={SQL Server};SERVER="&SERV&"; UID="&UID&"; PWD="&PWD&"; DATABASE="&DB&";" Conn.open DSN Response.Write("Connection Successful.") end if %> Code (markup): here is what I did to use it hard coded. ====================== <% dim Conn dim DSN dim UID dim PWD dim DB dim SERV UID="theUSERNAME" PWD="thePW" DB="theDBname" SERV="asdf.db.asdfasdfetc.." Set Conn = Server.CreateObject("ADODB.Connection") DSN="DRIVER={SQL Server};SERVER="&SERV&"; UID="&UID&"; PWD="&PWD&"; DATABASE="&DB&";" Conn.open DSN Response.Write("Connection Successful.") end if %> Code (markup): as well as tried this.. ================================== <% dim Conn dim DSN dim UID dim PWD dim DB dim SERV Set Conn = Server.CreateObject("ADODB.Connection") DSN="DRIVER={SQL Server};SERVER=asdf.db.asdfasdfetc..; UID=theUSERNAME; PWD=thePW; DATABASE=theDBname;" Conn.open DSN Response.Write("Connection Successful.") end if %> Code (markup):
What event do you have triggering the hardcoded version? Also if that is your exact code you have an "end if" statement with no "if" statement. Have you tried a standard connectionstring in your web.config with the form of: <connectionStrings> <add name=â€Personal†connectionString=†Server=whsql-v04.prod.mesa1.....; Database=theDB; User ID=user_id; Password=password; Trusted_Connection=False†providerName=â€System.Data.SqlClient†/> <remove name=â€LocalSqlServerâ€/> <add name=â€LocalSqlServer†connectionString=†Server=whsql-v04.prod.mesa1......; Database=theDB; User ID=user_id; Password=password; Trusted_Connection=False†providerName=â€System.Data.SqlClient†/> </connectionStrings>