By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,080 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,080 IT Pros & Developers. It's quick & easy.

best way to connect to a database?

P: n/a
I would like to know what is the best way to onnect to connect to a
database in general which provides you with full functionality & fast
access?
Best Regards,
Jassim Rahma

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jassim,

Do you need to connect to a particular database, or do you need to
connect to any database?

If you have a specific database type to connect to, then look to see if
there are managed database providers for that DB. For example, if you want
to connect to Sql Server, then you will want to connect to the classes in
the System.Data.SqlClient namespace.

If you need to connect to any database in a generic way, the standard
classes (data adapters, connections, etc, etc) all implement an interface
(IDbConnection, IDbDataAdapter in .NET 1.1 and before) or derive from a
common base class (DbConnection, DbDataAdapter in .NET 2.0). You can use a
factory pattern to get specific instances of these types, and cast to the
base class/interface. The problem here is that you have to make sure that
the queries that you use across all of the different db providers will work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jassim Rahma" <jr****@hotmail.com> wrote in message
news:uv***************@TK2MSFTNGP15.phx.gbl...
I would like to know what is the best way to onnect to connect to a
database in general which provides you with full functionality & fast
access?
Best Regards,
Jassim Rahma

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2

P: n/a
Well, the fasted and most functional is to probably access the database
using low-level database APIs. Unless you want to deal with these APIs, the
only real choice is to use what is in the System.Data namespace. Can you
offer a more specific question?

"Jassim Rahma" <jr****@hotmail.com> wrote in message
news:uv*************@TK2MSFTNGP15.phx.gbl...
I would like to know what is the best way to onnect to connect to a
database in general which provides you with full functionality & fast
access?
Best Regards,
Jassim Rahma

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3

P: n/a
Jassim,

I'd like to follow-up on Nicholas's first question. I'm in the process of
building my very first C# application. I come from a VB background. So my
first inclination was to save the app's data into an MDB database. But after
talking with a colleague of mine and doing a lot of reading I decided that
saving to an XML data file was much better suited to my needs.

If you're in a similar boat then let me know and I can help you out with
some sample code. FYI the ReadXML function works great but I couldn't get
SaveXML to work for my data model ... so I just wrote my own and it was very
straightforward, using Reflection code to cycle through my data model.

--
Robert W.
Vancouver, BC
www.mwtech.com

"Peter Rilling" wrote:
Well, the fasted and most functional is to probably access the database
using low-level database APIs. Unless you want to deal with these APIs, the
only real choice is to use what is in the System.Data namespace. Can you
offer a more specific question?

"Jassim Rahma" <jr****@hotmail.com> wrote in message
news:uv*************@TK2MSFTNGP15.phx.gbl...
I would like to know what is the best way to onnect to connect to a
database in general which provides you with full functionality & fast
access?
Best Regards,
Jassim Rahma

*** Sent via Developersdex http://www.developersdex.com ***


Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.