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...

Sequence to connect and retrieve data from database useig
dataset ?

Answer Posted / pushpendra singh

step 1---// Connection creation using Connection string
to connect SQL database

SqlConnection conn=new SqlConnection("data
source=server_name;initial catalog=database_name;integrated
security=sspi");

conn.Open();

step2----execute command using SqlCommand Class.

SqlCommand cmd=new SqlCommand("select * from asd",conn);

DataSet ds=new DataSet();

SqlDataAdapter da=new DataAdapter();
da.SelectCommand=cmd;

//insert data from dataadapter to dataset

da.Fill(ds);

dataGridView1.DataSource=ds.Tables[0];
conn.Close();

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the dataadapter class in ado.net?

1202


Which database is the ado.net sql connection object designed for?

1034


What is ado.net code?

922


Which is better entity framework or ado.net?

1037


What are the types of databinding?

985


What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?

1016


What is a column variable?

933


Which method is used by command class to execute SQL statements that return single value?

1041


How to maintain the relation between two tables in ADO.NET?

1003


What are the Features of a dataset

1299


What is ado.net architecture?

922


How to retrieve the user id which is provided while windows authentication?

1093


What is adodb dll?

994


Can you explain how to enable and disable connection pooling?

964


Name which operations can you not perform on an ado.net dataset?

982