Howdy, Stranger!

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

Categories

SQL connection String

' for Sql Server
Dim connectionString As String = "server=P-III; database=programmersheaven;" + _
"uid=phuser; pwd=nicecoding;"

The above code is from the on-line tutorial

Can somebody explain the above string for me? For example, "server=P-III", is this the name of the computer that has the database? And "database=programmersheaven", How does this correspond to the database on the hard disk? Do we not need to give the complete path and file extension, e.g. "database=c:programmersheaven.mdf"? I am completely lost on this and cannot get the on-line example to work. It sticks at the DataAdapter so I assume I have an incorrect connectionstring.

Many thanks

Comments

  • blumblum Member Posts: 1
    : ' for Sql Server
    : Dim connectionString As String = "server=P-III; database=programmersheaven;" + _
    : "uid=phuser; pwd=nicecoding;"


    the connection string assumes that you have an sql server running at the machine called P-III,
    and the sql server is hosting a database called "programmersheaven"
    and that the username and password for accessing them are also mentioned.
    its not for accessing an mdf file directly. its for accessing the database through the sql server.
    GoodLuck
  • BaldersBalders Member Posts: 2
    Thanks for your input.

    I finally worked out the string by looking how VB wrote the string in the XML file that is created when you connect to a database using the wizzard.

    I have finally started to understand how it is all fitted together.


  • Bharathi-kBharathi-k Member Posts: 22
    Hi,

    Try this article http://www.vkinfotek.com/data.html

    Regards
    knowledge is power
    bhar


    : ' for Sql Server
    : Dim connectionString As String = "server=P-III; database=programmersheaven;" + _
    : "uid=phuser; pwd=nicecoding;"
    :
    : The above code is from the on-line tutorial
    :
    : Can somebody explain the above string for me? For example, "server=P-III", is this the name of the computer that has the database? And "database=programmersheaven", How does this correspond to the database on the hard disk? Do we not need to give the complete path and file extension, e.g. "database=c:programmersheaven.mdf"? I am completely lost on this and cannot get the on-line example to work. It sticks at the DataAdapter so I assume I have an incorrect connectionstring.
    :
    : Many thanks
    :

Sign In or Register to comment.