Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how find recored from the database

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


Please Help Members By Posting Answers For Below Questions

Name the property which is used to lock a textbox to enter data?

1085


Name the class to be inherited for creating a custom control.

989


To which namespace does the control class belong?

959


What are windows applications?

906


Explain how to split a column header in gridview using c#.net?

1006


Name the event that enables the user to prevent shifting of focus from control until all the validation rules have been met.

918


Which event occurs when a user drags an item in a treeview or listview control?

976


What is formdata?

1034


How can you pause a timer control?

1051


What is the extension of a compiled help project file?

1115


What is form and its uses?

958


What are the three states set in a checkstate property?

973


What is the use of play() playlooping() functions?

1046


What are window applications?

900


What is window form application?

940