Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2003, 12:13 AM
Registered User
 
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can connect VB.Net with ADO.Net?

Hi All,

I am new in VB.NET please help me.

Waiting you peoples reply as soon as possible.

Regards,
Arvind Pathak


 
Old November 6th, 2003, 09:22 AM
Authorized User
 
Join Date: Jun 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is your database SQL Server, or MS Access, etc
- How much do you know of Sql & Ole connection objects, and datasets.
- Use Sql objects for SQL Server and Ole Objects for MS Access & others.

Typical script (Sql Server): (Connect, open and fills dataset)
dim dsSql as new DataSet("My Data")
dim sqlConn as new SqlConnection("user id=yourid;password=yourpwd;initial catalog=yourdatabase;data source=yourSQLServername")

dsSql.Tables.Add("MyTable") 'Add a new table
sqlConn.Open() 'opens your connection

dim sqlCmd as string="SELECT * FROM YourTable"
dim daSql as new SqlDataAdapter(cmdSql,sqlConn)
daSql.Fill(dsSql.Tables("MyTable")
sqlConn.Close() 'close connection ..if no more work

Now your table is filled into 'MyTable' datatable in your dataset.
Access your data by acessing your datatable, if you don't know how, look at the help doc or MSDN at www.msdn.microsoft.com

Use OleDataConnetion and OleDataAdapter, you need to find out the connection string as it is different from Sql Server, seach on 'ConnectionString' in help doc or MSDN.
You can d/l ODBC.Net from MSDN and use ODBC instead for both.

Hope I am being help to you, good luck..

Kasie







Similar Threads
Thread Thread Starter Forum Replies Last Post
How to connect to Access db thru VB.NET? am_kuthus Visual Studio 2008 1 June 3rd, 2008 04:48 AM
How to connect to remote database with vb net? qiux ADO.NET 4 May 8th, 2008 08:11 PM
how vb.net connect access database abbee99 ADO.NET 1 April 29th, 2005 04:21 AM
MSDE and SQL CE (using VB.NET and ADO.NET) LEGS ADO.NET 0 July 12th, 2003 11:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.