Click here to Skip to main content
16,021,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to commands for database access & an example for a SELECT form, i.e. : I need them for a simple Select Query?
C#
SqlDataReader Reader;
SqlConnection Connection = new SqlConnection("Data Source=;Database=contact.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlCommand Command = new SqlCommand();
SqlDataAdapter Adapter = new SqlDataAdapter();
DataSet ;
Posted
Updated 20-Oct-10 22:46pm
v2

Database db = DatabaseFactory.CreateDatabase("Paste your connection string here");
DbCommand command = db.GetSqlStringCommand("write your simple select * command here");
command.Connection = db.CreateConnection();
command.Connection.Open();
DataSet ds = db.ExecuteDataSet(command);

You get result of your command in DataSet ds.

Try This

Best Luck!!!!!!
 
Share this answer
 
Comments
inhisname 21-Oct-10 6:34am    
Thank's a lot
Basically you need to know more about ADO.NET.
Have a look at this link: Accessing Data with ADO.NET[^]
 
Share this answer
 
See here[^]. Should help you start up.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900