how to connect DSN server
-
hello i have created a DSN server named "BLTPS" through control pannel ODBC service and using a userid and password property. now how i will connect to database through my code plz tell me which namespaces i have to add and what is the syntax. plz help me soon thanks
-
hello i have created a DSN server named "BLTPS" through control pannel ODBC service and using a userid and password property. now how i will connect to database through my code plz tell me which namespaces i have to add and what is the syntax. plz help me soon thanks
What you need to use is called ADO.NET. It's a collection of .NET classes under the
System.Data
namespace which allow you to work with various databases. This is a big subject and I highly recommend that you read up on this on MSDN. See the below link. You should also search this website and the Internet on this subject too. There's plenty of examples out there. http://msdn.microsoft.com/library/en-us/cpguide/html/cpconoverviewofadonet.asp[^] That said, you need to use the data provider classes under theSystem.Data.ODBC
namespace. Read the above link to understand how to use them. -
What you need to use is called ADO.NET. It's a collection of .NET classes under the
System.Data
namespace which allow you to work with various databases. This is a big subject and I highly recommend that you read up on this on MSDN. See the below link. You should also search this website and the Internet on this subject too. There's plenty of examples out there. http://msdn.microsoft.com/library/en-us/cpguide/html/cpconoverviewofadonet.asp[^] That said, you need to use the data provider classes under theSystem.Data.ODBC
namespace. Read the above link to understand how to use them. -
actuualy i have worked on oledb but not on ODBC. i have read a example in it they use ADODB but when i use it in my code it gives me error. there is no namespace of this name how i can use it plz tell me
iramg wrote:
i have read a example in it they use ADODB but when i use it in my code it gives me error.
That's the old ADO library used by VB6 and older versions. To use ADO.NET, you need to add a reference to the
System.Data.dll
in your project. In Visual Studio 2003, you can do this by right clicking on your project's References folder, select Add References, select System.Data.dll in the listbox, click Select, and then click OK. This will give you access to the System.Data namespace and all of its classes. You'll need to use the System.Data.Odbc.OdbcConnection class to connect to the database. The below link to MSDN will show you a quick example on how to use this class. http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataOdbcOdbcConnectionClassTopic.asp[^] I hope this helps!