eaweb
asked on
mssql db con via web.config
Hi,
I have the following in a web.config file for a db connection:
<connectionStrings>
<add
name="AppUsrConnectionStri ng"
connectionString="Data Source=CSQL03\BAPPS;Initia l
Catalog=AALSMGNT;Persist Security Info=True;User
ID=AER;Password=Abc765456"
providerName="System.Data. SqlClient"
/>
</connectionStrings>
Based on the above settings i am trying to connect to a mssql 2012 database using the following classic asp vb coding:
Dim strConnection
strConnection = ConfigurationManager.Conne ctionStrin gs("AppUsr Connection String").T oString()
to execute below query:
Dim strQueryUserCheckCount
strQueryUserCheckCount = "SELECT count(*) FROM AppUsrD where AppUsr_DWI = '" & Session("UserName") & "'"
'--- build connections for query executions
Dim objStringDataConnectionStr QueryUserC heckCount
objStringDataConnectionStr QueryUserC heckCount = New SqlConnection(strConnectio n)
objStringDataConnectionStr QueryUserC heckCount. Open()
Dim objConnStrQueryUserCheckCo unt, userRecordCountCheck
objConnStrQueryUserCheckCo unt = New SqlCommand(strQueryUserChe ckCount, objStringDataConnectionStr QueryUserC heckCount)
userRecordCountCheck = objConnStrQueryUserCheckCo unt.Execut eScalar()
However i am not able to connect to database. please some help in making it work and in creating a db connection test page.
Thanks in advance
I have the following in a web.config file for a db connection:
<connectionStrings>
<add
name="AppUsrConnectionStri
connectionString="Data Source=CSQL03\BAPPS;Initia
Catalog=AALSMGNT;Persist Security Info=True;User
ID=AER;Password=Abc765456"
providerName="System.Data.
/>
</connectionStrings>
Based on the above settings i am trying to connect to a mssql 2012 database using the following classic asp vb coding:
Dim strConnection
strConnection = ConfigurationManager.Conne
to execute below query:
Dim strQueryUserCheckCount
strQueryUserCheckCount = "SELECT count(*) FROM AppUsrD where AppUsr_DWI = '" & Session("UserName") & "'"
'--- build connections for query executions
Dim objStringDataConnectionStr
objStringDataConnectionStr
objStringDataConnectionStr
Dim objConnStrQueryUserCheckCo
objConnStrQueryUserCheckCo
userRecordCountCheck = objConnStrQueryUserCheckCo
However i am not able to connect to database. please some help in making it work and in creating a db connection test page.
Thanks in advance
also, this looks to be .NET, should probably be moved to that area for better responses
ASKER
No, changing the connection still doesn't work.
Can you help me with a connection test page maybe?
Can you help me with a connection test page maybe?
ASKER
Hi admin
Please move my question to the .Net area,
Please move my question to the .Net area,
ASKER
use asp.net vb
ASKER
Hi,
Please some help.
Thanks!
Please some help.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
strConnection = "Provider=SQLOLEDB; Server=localhost; database=db_name; uid=user_name; Password=pass_word;"
http://www.connectionstrings.com/sql-server-2012/