[RESOLVED] Connecting to SQL Server
Im trying to connect to a database, but it keeps saying "The ConnectionString property has not been initialized. " Im not sure what its refering to, my code or my connection string, Im using windows authentication in SQL Server Management. But not sure what I need to do here
<add name="MyDbConn1" connectionString="Server=MyServer;Database=Omni_Test;Trusted_Connection=Yes;"/>
Dim DBConnect As SqlConnection = Connection()
Private Shared Function Connection() As SqlConnection
Dim sConnection As String = System.Configuration.ConfigurationManager.AppSettings("MyDbConn1")
Return New SqlConnection(sConnection)
Looks Like Ive upgraded my Error now it says
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
Im pretty sure its the connection string but I don't now what to put in there?
Or if I try to use Integrated Security=True in the connection string it says
Cannot open database "Omni_Test.dbo" requested by the login. The login failed.
Login failed for user 'NATHANCO-5AC28D\Nathan'.
Make sure your windows account has the permission to login to your sql server. It seems that you can not login with this username.
Have you tried logging in with an sql account?
I figured it out was the connection string, I just changed it
value="Server=ServerName;Database=DBName;Integrated Security=True" />
Now it works
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)