Click here to Skip to main content
14,975,411 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create an object for a class and name spaces for database access ?
Posted

please make it more elaborative.
however according to my current understanding i suppose you can add LINQ to SQL file in your project.
same thing can also be done with Entity ADO.NET Entity Data Model File
Accept the solution if you got your answer
thanks...
   
for "ms acces database" access, first you need to include following namespaces in your project.

using System.Data; // in form application it is already included
using System.Data.OleDb;

Now here goes the code:

OleDbConnection con = new OleDbConnection("here your database connection string (including @ before string)");

string query="here your query";

OleDbDataAdapter da=new OleDbDataAdapter(query,con);
DataTable dt=new DataTable();
da.Fill(dt);

//now your record has been fetched.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900