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

What are the steps in connecting to database ?

Answer Posted / kalirajan

// Declare Namespace as ur Lang...
In c#

Using System.Data.SqlClient;

//connection

SqlConnection con = new
SqlConnection("server=localhost;database=Grid_Db;uid=sa;pwd=;");

con.Open();

SqlCommand cmd = new SqlCommand("select * from Gtid_Tbl",con);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

da.Fill(ds);

GridView1.DataSource = ds;
GridView1.DataBind();

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to identify the controls which can be used for binding data?

1046


Give an example of a .net application which connects to microsoft access database using ado.net classes.

1221


What is data control techniques?

1003


Which parameter of ConnectionString is used to specify the name of the database?

1114


Explain how to call the sql commands asynchronously in ado.net version 2.0?

980


Explain why canot we use multiple inheritance and garbage collector paralelly in .net?

1070


Which is faster sqldataadapter and sqldatareader?

980


What is difference between connected and disconnected architecture in ado.net?

1205


How do you update a dataset in ado.net?

1064


How to Read, Add, Update and Delete record in Entity Framework ?

1099


Which object holds only data and does not interact with data source?

1041


What does ado stand for in ado.net?

1196


What is the maximum pool size in ado.net connection string?

994


What is sqlconnection and sqlcommand?

1201


What is the difference between typed and untyped dataset?

1168