|
-
Mar 22nd, 2010, 09:46 AM
#1
Thread Starter
Member
[RESOLVED] Help with MS SQL Server Connection String
So I installed MS SQL with all the default options. During the installation it asked me for a root password. I entered "aTest1!"
When I open up the management tools I get this:

I just hit connect and then made a new database called "timesheet1".
Now it is time to connect via vb.net.
I went to www.connectionstrings.com and got this string:
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
I have tried all of the following:
Data Source=PGUNNEWIEK-TM77\SQLEXPRESS;Initial Catalog=timesheet1;User Id=C3BRESLAU\pgunnewiek; Password=aTest1!;
Data Source=PGUNNEWIEK-TM77\SQLEXPRESS;Initial Catalog=timesheet1;User Id=C3BRESLAU\pgunnewiek;
Data Source=PGUNNEWIEK-TM77\SQLEXPRESS;Initial Catalog=timesheet1;User Id=pgunnewiek;
Every time I get login failed.
I have never worked with SQL before so I am not sure what I am doing wrong.
The code I am using is from a codebank example on these forums. It can be seen below:
Code:
Imports System.Data.SqlClient
Module Module1
Sub Main()
Dim ConnectionString = "PGUNNEWIEK-TM77\SQLEXPRESS;Initial Catalog=timesheet1;User Id=C3BRESLAU\pgunnewiek; Password=aTest1!;"
' Check if the Employee is already in the Database
Using connection As New SqlConnection(ConnectionString)
Using command As New SqlCommand("SELECT NameFirst, NameLast FROM Employees", _
connection)
connection.Open()
Using reader As SqlDataReader = command.ExecuteReader()
While reader.Read()
Console.WriteLine(reader)
End While
End Using
End Using
End Using
End Sub
End Module
Last edited by dethredic; Mar 22nd, 2010 at 09:52 AM.
-
Mar 22nd, 2010, 09:50 AM
#2
Re: Help with MS SQL Server Connection String
You should not be using
User Id=myUsername;Password=myPassword
Use Trusted_Conenction = TRUE
Since this is SQLExpress then the servername is: PGUNNEWIEK-TM77\SQLEXPRESS
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Mar 22nd, 2010, 09:50 AM
#3
Re: Help with MS SQL Server Connection String
Head back over to connectionstrings.com ... find the connection string for SQL Server with integrated security... odds are, that's the one you want.
-tg
-
Mar 22nd, 2010, 10:06 AM
#4
Thread Starter
Member
Re: Help with MS SQL Server Connection String
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|