rpcarnell
02-05-2006, 03:27 PM
I am sort of new to ASP.net.
What's the syntax for connecting to a MYSQL database using ADO.NET? Every page I get, very tutorial, is always about SQL.
russell_g_1
02-06-2006, 02:16 PM
.net can connect to databases using one of several namespaces. these are all in system.data and are called odbc, oledb, sqlclient, oracleclient, etc. each of them provides an almost identical interface from the program side.
the oracleclient one is obviously designed to connect to an oracle database. sqlclient is for ms sql server. odbc goes through the odbc stuff setup on your system so you can use dsns. and oledb allows you to connect to all sorts of other dbs.
to get to a mysql db you have to use either odbc or oledb i think. there's an example here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoledboledbdatareaderclasstopic.asp?frame=true showing how to use oledb, odbc is exactly the same apart from the class names having odbc on the front.