Remote SQL Connection String

[b][red]This message was edited by GWHicks at 2002-12-1 16:50:53[/red][/b][hr]
I am writing a VB.Net app that access an SQL database stored on my webserver. When I use MySQLFront program I can get into the database and make all the changes I want so I know I can connect to it. But I am having trouble coming up with the proper connection string in my VB.Net app. The connection strings I have tried are listed below. If anyone can point me in a direction to do this it would be greatly appreciated.

Connection String 1:
Provider=SQLOLEDB;Server=xxx.xxx.xxx.xxx,1433;Database=datafile;User ID=username;Password=password

Connection String 2:
Network Library=DBMSSOCN;Data Source=xxx.xxx.xxx.xxx,1433;Initial Catalog=datafile;User ID=username;Password=password

Connection String 3:
User ID=username;PWD=password;DATABASE=datafile;SERVER=xxx.xxx.xxx.xxx,1433;DRIVER={SQL Server}

And the code used to open the database:
Dim cn As SqlConnection = New SqlConnection()
cn.ConnectionString = data_path
cn.Open()

data-path is a string populated from a text file (ini file) that code is being read properly so I am pretty sure it is not in that area.
Thanks for any help you can offer.
Greg Hicks


Comments

  • : [b][red]This message was edited by GWHicks at 2002-12-1 16:50:53[/red][/b][hr]
    : I am writing a VB.Net app that access an SQL database stored on my webserver. When I use MySQLFront program I can get into the database and make all the changes I want so I know I can connect to it. But I am having trouble coming up with the proper connection string in my VB.Net app. The connection strings I have tried are listed below. If anyone can point me in a direction to do this it would be greatly appreciated.
    :
    : Connection String 1:
    : Provider=SQLOLEDB;Server=xxx.xxx.xxx.xxx,1433;Database=datafile;User ID=username;Password=password
    :
    : Connection String 2:
    : Network Library=DBMSSOCN;Data Source=xxx.xxx.xxx.xxx,1433;Initial Catalog=datafile;User ID=username;Password=password
    :
    : Connection String 3:
    : User ID=username;PWD=password;DATABASE=datafile;SERVER=xxx.xxx.xxx.xxx,1433;DRIVER={SQL Server}
    :
    : And the code used to open the database:
    : Dim cn As SqlConnection = New SqlConnection()
    : cn.ConnectionString = data_path
    : cn.Open()
    :
    : data-path is a string populated from a text file (ini file) that code is being read properly so I am pretty sure it is not in that area.
    : Thanks for any help you can offer.
    : Greg Hicks
    :
    :
    :

    trye this format ...

    Provider=SQLOLEDB;data source=xxx.xxx.xxx.xxx,1433;
    User ID=username;Password=password;initial catalog=TheDatabaseName;

  • : : [b][red]This message was edited by GWHicks at 2002-12-1 16:50:53[/red][/b][hr]
    : : I am writing a VB.Net app that access an SQL database stored on my webserver. When I use MySQLFront program I can get into the database and make all the changes I want so I know I can connect to it. But I am having trouble coming up with the proper connection string in my VB.Net app. The connection strings I have tried are listed below. If anyone can point me in a direction to do this it would be greatly appreciated.
    : :
    : : Connection String 1:
    : : Provider=SQLOLEDB;Server=xxx.xxx.xxx.xxx,1433;Database=datafile;User ID=username;Password=password
    : :
    : : Connection String 2:
    : : Network Library=DBMSSOCN;Data Source=xxx.xxx.xxx.xxx,1433;Initial Catalog=datafile;User ID=username;Password=password
    : :
    : : Connection String 3:
    : : User ID=username;PWD=password;DATABASE=datafile;SERVER=xxx.xxx.xxx.xxx,1433;DRIVER={SQL Server}
    : :
    : : And the code used to open the database:
    : : Dim cn As SqlConnection = New SqlConnection()
    : : cn.ConnectionString = data_path
    : : cn.Open()
    : :
    : : data-path is a string populated from a text file (ini file) that code is being read properly so I am pretty sure it is not in that area.
    : : Thanks for any help you can offer.
    : : Greg Hicks
    : :
    : :
    : :
    :
    : trye this format ...
    :
    : Provider=SQLOLEDB;data source=xxx.xxx.xxx.xxx,1433;
    : User ID=username;Password=password;initial catalog=TheDatabaseName;
    :
    :
    Thanks I finally got it, the proper string ended up being:
    User ID=username;PWD=password;DATABASE=datafile;SERVER=xxx.xxx.xxx.xxx;DRIVER=MySQL

    I had to take off the port number and add the Driver=MySQL command and I was in. Thanks for your input, I knew it was something simple!
    Greg Hicks
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!

Categories