Initial Database Questions

I am a database newbie and I am very inexperienced in programming in general. For a C # console application (I am writing with VS Express) that will have a UI added after testing, I need to use a database to store my data.

Can someone tell me, or point me to, explain the initial explanations, both pros and cons, of these database access methods so that I can decide which I should use ?:

  • SQLClient
  • ORM
  • OleDB
  • ODBC
  • ADO.NET
  • NHibernate
  • MS Enterprise Corporation
+2


source to share


3 answers


Quite a mix there ... first some explanations ...

1) SQL Client An SQL Client is an application that connects to a SQL database to query / manipulate / manipulate data in the SQL database. (any program accessing the database, phpAdmin, SQLite admin, etc.).

2) ORM - Object Relational Mapping. Its a way to convert different data types when the data types are not compatible. Think of a car class that includes four instances of the tire class. This type of structure does not translate well into the types available in database design and may be the reason for using ORM. (To link objects (car, tires, etc.) to simple database types (integer, float, blob, etc.)

3) OLE (pronounced Olay) DB Is the Microsoft method (API) to connect to a database using COM. OLE DB is part of the MDAC Stack (a grouping of MS technologies that work together in data access).

4) ODBC is Open Database Connectivity and its alternative API for database management systems (DBMS). Where OLE DB is the COM (Component Object Model) way of integrating with databases, ODBC aims to be language independent.



5) ADO.NET is a set of base classes (API) for use in .NET languages ​​for connecting and communicating with databases.

I would suggest starting with ADO.net for your C # background, OLE generally for older applications (VB classic). There is a good beginner tutorial here. http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx

Don't let all the terminology scare you off, once you jump in and start messing around you will understand all the answers provided better ...

Best of luck with your coding! :-)

+6


source


SQLClient, OleDB, ODBC are DBMS Drivers / ADO.NET implementations of various DMBSs (erroneously, hope this makes sense). For example, SQLClient is an ADO.NET implementation for connecting to a SQL Server database. Choosing between these drivers is exactly the database you want to use. For newbies, I would suggest SQL Server as you probably have some version already installed.



ORM stands for Object Relational Mapping. This is a code-behind implementation of an automatic mapping between your code models and your database that stores it. If you don't want to manually touch the database while you are learning, this is a good option - it is something that is useful for both professionals and beginners as it allows you not to worry about implementing the underlying database or writing CRUD (create, read , update, delete). Take a look at ActiveRecord for .net ( http://www.castleproject.org/activerecord/index.html )

+3


source


If you're looking for an easy introduction to databases in C #, you'll want to use LINQ and the data context.

Just add Data Context to your project. Double-click the file to open the designer for the LINQ data context. Open "Server Explorer" in visual studio (under "View") and connect to your SQL Server. Using this, you can drag and drop your tables into the LINQ designer in visual studio.

Go to google and look at using linq with context to work with your DB.

I'll go over here with LINQ to say that it encourages you to write better database code that doesn't pull the entire dataset in one go and doesn't work on it, you defer queries and you can greatly benefit from the functional infrastructure on which they were built.

But it has a big learning curve, the best way to do it is to try different types of code and see the ones that make sense to you.

+1


source







All Articles