Help! SQL/ADO problem (easy...!)

Hi every1!
im learning vb through a book.. an example uses SQL server to create a database.
ive downloaded SQL server from microsoft and can install it (i think neway!)

what im asking is:

how do i connect to the SQL server on my own pc so i can use the "pubs" database? - the book suggests the code:
Dim objConnection As New SqlConnection = New _

but it dont work!
Also, when you install SQL server, it says you have2 specify a 'strong' password. what does this mean?

greatfull if ne1 can help here!


  • Your connection string seems to be wrong.


    Lets start with some basics. First I am not sure the Pubs DB is included by default with SQL. You may have to import it.

    Do you have Enterprise manager(I.E. Client tools) installed? Enterprise manager is GUI for SQL and you can look at your server properties and what DBs are currently attached to the server.

    If not you can use the command line tool which included with all types of SQL including MSDE. Run 'OSQL -L' from the command line to get a list of all server instances. If you gave your server an instance name at install using '(local)' alone will not work you will need to apend the instance name to the server i.e. ('(local)MyInstanceName'). If you added a password at install it is for the sa user and you will need it in the connection string as well.

    You can try to connect from the command line like so

    'OSQL -S (Local)MyInstanceName -d MyDBName -U MyUser -P MyPass'
    or this for a trusted user (ie the user is added in the SQL security for this DB)
    'OSQL -S (Local)MyInstanceName -d MyDBName -E'

    Hope that helps if not catch the error you get when you cannot connect and post it.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion