-
Junior Member
db connectivity
Hi
i have three fields
emp name
empid
emp dept
now i want to connect to acess db and want to populate the db with new records
-
Re: db connectivity
So whats the problem then ?
-
Junior Member
Re: db connectivity
It is similar to any other DBMS like SQL.
Use ODBCConnection and OdbcReader .In Connection String= ";dbq="Pathname of file;dsn=access files ";
-
Junior Member
Re: db connectivity
see the sample below,
string dbConnString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp\test.mdb";
OleDbConnection dbConn = new OleDbConnection(dbConnString);
OleDbCommand dbCommand = new OleDbCommand();
dbCommand.Connection = dbConn;
dbConn.Open();
dbCommand.CommandType = CommandType.Text;
dbCommand.CommandText = "Select * from Employee";
OleDbDataReader dr = dbCommand.ExecuteReader();
while (dr.Read() == true)
{
Console.WriteLine(dr["uid"].ToString() + ":"+ dr["uname"].ToString() + ":" + dr["udept"].ToString());
}
dbConn.Close();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules