borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic ( How can i populate my datagrid control by calling a oracle store procedure ??)Next Topic (HELP! need a connection string) New Topic New Poll Post Reply
AndreaVB Forum : Database : VB6 with ODBC to SQL
Poster Message
krishna_thakrar
Level: Guest


icon VB6 with ODBC to SQL

I have a project in VB6 where I need to get data from a Remote SQL7 server vis ODBC.

Can anybody take me through the steps from connectiong to remote computer to getting the data.

Best Wishes

10-08-2002 at 04:36 PM
| Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: VB6 with ODBC to SQL

Hi,

The simplest way is to use a DSN.
On your control panel, use the ODBC manager to create a new dsn and point it to the remote SQL server.

Your ADO connection string is then "dsn=mydsn;user id=myuid; password=mypwd"

Hope this helps,

Kieron

____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

09-09-2002 at 11:59 PM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon Re: VB6 with ODBC to SQL

A few steps to build the connection string without typing it:
1) Add a "Microsoft ADO Data Control 6.0 (OLEDB)" control to a form. (from the components list)
2) Right click the control, select ADODC properties.
3) Click the Build button.

follow the prompts (SQL is for SQL server, Microsoft Jet is for Access)

4) once you select OK, the connection string needed to connect to the database will be in the "Use connection string" box, copy it.

Use the string for either the control itself, or a connection variable.

For example:
' "Typical" SQL connection
Dim adc as new ADODB.Connection
Set adc = new ADODB.Connection

' Integrated Security = use NT login info
' Initial Catalog= Database name
' Data Source=SQL Server name, (local)=PC program's running on
adc.open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=northwind;Data Source=(local)"

Set adc = Nothing

10-09-2002 at 02:15 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : VB6 with ODBC to SQL
Previous Topic ( How can i populate my datagrid control by calling a oracle store procedure ??)Next Topic (HELP! need a connection string) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder