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 do I change the console application in windows?
How many navigational features are provided by visual studio.net ide?
Name the template that is used to create a user-defined component.
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?
What are the forms of database?
How to show a ContextMenuStrip instead of cthe default ContextMenuStrip,when you rightclick on the non client area of a window's Form or when alt+space keys are pressed
Explain the difference between listindex and tab index?
which property is used to change to some value to access a identity column in datacontrols?
How will calculated the net amount in tax add like total net amount = LT+ST+CESS+amount 2500 = 10%+12.5%+5.15%+amount? kindly please explain what type of formula we apply in software? Tushar
Which event occurs when a user drags an item in a treeview or listview control?
Which dialog box allows users to switch to another area of the application?
Is typeform free?
What is window form application?
What is difference between winforms and windows forms?
What are the advantages of form?