Help! SQL/ADO problem (easy...!) - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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

tumbleweed_12tumbleweed_12 Posts: 2Member
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 _
SqlConnection("server=(local);database=pubs;userid=sa;password=")

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!


Comments

  • rlcrlc Posts: 448Member
    Your connection string seems to be wrong.

    "server=(local);database=pubs;userid=sa;password="

    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.

    ~rlc

Sign In or Register to comment.