Click here to Skip to main content
15,911,762 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How I insert Untyped DataTable with some data to Access DataBase(.accdb)?.
Posted
Updated 16-Dec-12 22:14pm
v2
Comments
[no name] 17-Dec-12 4:19am    
Can you please elaborate more for better understanding?
Killzone DeathMan 19-Dec-12 11:16am    
Maybe he's shy... :D
Killzone DeathMan 19-Dec-12 11:16am    
Maybe this help you:

1) First add "using System.Data.OleDb;" at to top of the CS file.
2) Create connection string and open connection.
For access 2007
string ConnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\abc.mdb;Jet OLEDB:Database Password=password";

OleDbConnection MyConn = new OleDbConnection(ConnStr);



3) Open this connection.
MyConn.Open();

4) Create object for command and reader to get the data from access database.

OleDbCommand Cmd = new OleDbCommand(StrCmd, MyConn);;
OleDbDataReader ObjReader = Cmd.ExecuteReader();


5) Now lood through the reader object to get the data

if (ObjReader != null)
{

}

6) After completing the processing
ObjReader.Close();
MyConn.Close();


Regards,
KZ

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