hi experts,

i am new in asp.net even i do not know how can i start a new project.
please help me in connection coding with ms access.

Recommended Answers

All 2 Replies

For connecting to a database you need several things. A connection string holds the information relevant to connecting to the database (location, login details, security, etc), a connection object which you open and close to connect to the database and a command object which takes the SQL query and actions it on the database inserting or returning data as appropriate.
There is a very useful site that has all the connection strings you will ever need. I can't remember the name but type 'connection strings' into google and you'll find it.

A basic database section of code might look like this in C#

string connectionStr = // your connection string goes here;
String SQL = "select * from some_table";
oleDbConnection conn = new oleDbConnection(connectionStr);
oleDbCommand cmd = new oleDbCommand(sql, conn);
dataTable dt = cmd.executeScalar();

you can obviously return a range of data types: strings, ints, row sets or entire tables. What you are returning will determine what object you use to catch and handle the returned data.
Thats a basic start anyway. Hope it helps.

For connecting to a database you need several things. A connection string holds the information relevant to connecting to the database (location, login details, security, etc), a connection object which you open and close to connect to the database and a command object which takes the SQL query and actions it on the database inserting or returning data as appropriate.
There is a very useful site that has all the connection strings you will ever need. I can't remember the name but type 'connection strings' into google and you'll find it.

A basic database section of code might look like this in C#

string connectionStr = // your connection string goes here;
String SQL = "select * from some_table";
oleDbConnection conn = new oleDbConnection(connectionStr);
oleDbCommand cmd = new oleDbCommand(sql, conn);
dataTable dt = cmd.executeScalar();

you can obviously return a range of data types: strings, ints, row sets or entire tables. What you are returning will determine what object you use to catch and handle the returned data.
Thats a basic start anyway. Hope it helps.

thankyou so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.