-
ODBC creation
Does anyone know how to create an ODBC connection through VB code. I need
to do this for report generation.
my goal is to have 5 ODBC connections create the first time a program runs,
but I honestly have no clue where to begin.
Thanks
-
Re: ODBC creation
Check out the API call SQLConfigDataSource.
-- Joel
Intern wrote:
> Does anyone know how to create an ODBC connection through VB code. I need
> to do this for report generation.
>
> my goal is to have 5 ODBC connections create the first time a program runs,
> but I honestly have no clue where to begin.
>
> Thanks
-
Re: ODBC creation
Go to the Refrences in the Project on the VB Menu Editor,and include Microsoft
Active Data Objects 2.1 Library,Now u can follow the code to create a connection
dim cn as adodb.connection
set cn=new adodb.connection
cn.open "MyConnection"
Well before opening the connection u have to create a driver for ur database,if
u r using win2000 then goto control panel click on Administrative Tools,then
click on datasources(odbc),in the System DSN tab ,click on new then select
the tool u r using to create database,e.g Access ,then click on Finish,in
the next screen enter "MyConnection" against Data Source Name and browse
the database,now this is the name "MyConnection" u have to give while opening
ur connection like
cn.open "MyConnection"
After opening the connection u can open recordsets like
dim rs as adodb.recordset
set rs=new adodb.recordset
rs.open "RecordSetName",cn
I hope now it will be clear
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks