PDA

Click to See Complete Forum and Search --> : connection string please help


Johnny23
Nov 5th, 2000, 04:14 PM
i would like to set my connection string property
i have a:
1. sql7 database
2. server name = nt009
3.databasename = mydatabase
4.username = sa
5.password = nothing no password

how do i do this:
[code]
ConnectString = "what do i put here for my connection string"

Nov 5th, 2000, 11:19 PM
Hi, u need to use ODBC to connect to Sql Server database. For this u first have to create a DSN (Data Source Name). You can do this by going to Control Panel -> ODBC32bit double click on it, select the appropriate name and driver, follow the instructions and connect it to ur database. Now u can use this DSN name in ur connection string.

All the best...vijay

barrk
Nov 6th, 2000, 01:16 PM
You can use ado and enter this as your connection string when you right click the adodc:
driver = {sql server};server=nt009;uid=sa;pwd=;database=mydatabase

Using ado eliminates the need to have the dsn set up on each individual client machine.

Nov 6th, 2000, 10:18 PM
Hi barrk, i would want to agree with u very much but before that i need to get an answer to this, do i not need to give the entire path of the database in my connection string. If yes how can i make sure that the path is the same for each of my clients. The best alternative i have found out is the concept of .ini. Please answer my question and make me agree with u...vijay

RIVES
Nov 7th, 2000, 08:07 AM
Hello

Have you ever thought of DSN less connection?

Are you going to use ADO?

the connection properties of an adodb.connection can be set before connecting to the database server.

use the dot notation to get the list of the properties you have to set.

e.g.

dim cn as ADODB.connection

cn."property" you want to set.

this way, you can connect to any database with the same structure(schema). You can have Test and Production databases at the same time and let users opt for whatever database they want to connect to.

Also, Are you using Windows NT trusted connection?

Why not intsall a client of sql server on your pc and then just use the ole db SQL server connection.

Hope this helps.

barrk
Nov 7th, 2000, 11:04 AM
Is the database on your server or the client machines? If it's on the server no path will be required obviously.

LG
Nov 8th, 2000, 01:09 PM
Hi, there.

You can try this:

Add Microsoft ADO Data Control 6.0 to your project.
Put it on your form. Right click on it, choose ADODC Properties. In General Tab check Use Connection String and click Build... button. Data Link Properties form will appear, in a Provider Tab choose Microsoft OLEDB for SOL Server,in a Connection Tab fill all fields, then hit Test Connection button. If the connection was established right you'll get a message, that it was successful. Hit OK. Then go to property window of ADO Data Control and copy ConnectionString property. Now you can put it in your code. And you can delete ADO Data Control.