Friend Shared ReadOnly Property connStr() As String
Get
Return String.Format( _
"Data Source={0};Initial Catalog=Otters;User ID=fadila;Password=fadil1977", _
DatabaseMachine)
End Get
End Property
SqlConnection...Please help!!
Hi !!
I have a code that runs from a different machine and a different site and i am facing a problem that i can not log in to the database.I installed SQL Server on my machine and I created a user "fadila" and SQL Server Authentication and the password is "fadil1977" and the database is "otters" and it is installed as tables and stored procedures but there is not data on these tables.
I used the method provided in the code so, i only change the "connStr" in one place rather than in 20 places and my code is as below. Can you please Help me to connect to the database. I Really..Really appreciate it if you help me to solve it as it causeing me a big head-ache and still get the error message "SQL Server does not exist or access denied" .. please help!!!!
alejandro.riveraPosted Oct 28, 2004, 4:13 PM
Private Shared Function sConn(ByVal as String databasemachine) As SqlConnection Dim strConnection As String strConnection = "server=servername;Trusted_Connection=true;database=" & databasemachine & ";User ID=user;Password=pw" Return New SqlConnection(strConnection) End FunctionI hope this works. I used a function instead of a property. This is what I use and it works the only difference is that I don't pass in any parameters.