Answer Posted / eric
You mean: "How do I get records from a database?"
You have to get the "dotnet driver" of the database (or any
other datasource) you want to access to.
For example:
MySQL: Connector/Net
Access: Microsoft Access Driver
Oracle: Oracle Data Access Components (ODAC)
Afterwards you build a connection string to tell your
programm which driver you want to use and where the
datasource can be found, for example:
public const string DB_CONN_STRING =
"Driver={Microsoft Access Driver (*.mdb)}; "+
"DBQ=D:\\CS\\TestDbReadWrite\\SimpleTest.mdb";
Afterwards you just have to open a connection to the
database using the previously created connection string and
send a query to the database to get the record:
ADOConnection conn = new ADOConnection(DB_CONN_STRING);
conn.Open();
ADODataReader dr;
ADOCommand cmd = new ADOCommand( "SELECT * FROM <table>",
conn );
cmd.Execute(out dr);
while (dr.Read()){
....}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
how print barcode
What are the three states set in a checkstate property?
What is difference between winforms and windows forms?
how see report periviwe
Which method grants a lock on a resource?
What is form and meaning?
how barcode print on the win form
What is an example of form?
What is form description?
What is the extension of a compiled help project file?
What is the difference between the add() and insert() methods of a listbox control?
What is the difference between desktop application and windows application?
Can you create a tabletype of recordset in Jet - connected ODBC dbengine?
Explain how insert record in the database?
Suppose I am implementing one windows form. I am inserting some values into ms access. In that table 5 columns there. But I want to insert three columns only. When I am clicking another button then other two values also insert into that table?