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
What are the properties of datacontrol?
To which namespace does the control class belong?
What are windows based applications examples?
Which window allows viewing the resources of the servers, such as services, processes and the event log?
how print PGL by XML
How do you apply specific formatting to the data inside the cells?
How to create a set up in vb.net for desktop application please say steps with examples?
How to get records from a database?
What are the components of gui for windows?
What are the advantages of form?
Explain something about crystal report in brief?
What is difference between winforms and windows forms?
Explain how insert record in the database?
What is form and its uses?
What is form record?