Results 1 to 4 of 4

Thread: [RESOLVED] Help with MS SQL Server Connection String

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2010
    Posts
    58

    Resolved [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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width