Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on db connectivity within the C# forums, part of the Software Development category; 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
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(); |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Connectivity in java with oracle | anuj.rawat | Java | 1 | 09-10-2007 05:13 AM |
| Methods and process of data connectivity | manishvas22 | Database Design | 3 | 09-03-2007 06:10 AM |
| About cpp connectivity | govindaraj123 | Mathematical Puzzles | 5 | 08-06-2007 03:11 AM |
| I am getting database connectivity error | sumana_i | Test Director | 0 | 04-06-2007 04:24 AM |