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 ?

Answers were Sorted based on User's Feedback



What are the steps in connecting to database ?..

Answer / 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

What are the steps in connecting to database ?..

Answer / khalid

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

Using System.Data.SqlClient;

//connection
//If u provide uname & passwd to ur Database then this state //is true
SqlConnection con = new
SqlConnection("server=localhost;database=urDB_Name;uid=sa;pwd=;");
//else
SqlConnection con = new
SqlConnection("server=localhost;database=urDB_Name;");

con.Open();
if(con!=null)
msgbox("Connection sucessfully Done!");
else
msgbox("Sorry!Connection sucessfully is not Done!");

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ADO.NET Interview Questions

What is ole in excel?

0 Answers  


What is the difference between dataset and datatable?

0 Answers  


Differnce between Stored procedure and user defined functions?

17 Answers   Microsoft, Symphony,


When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?

5 Answers   HCL,


What is the difference between DataReader and DataSet in ADO.NET?

0 Answers   Petranics Solutions,


how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....

1 Answers   Ford,


What are the rules to implement connection pooling?

0 Answers  


What are the ADO.NET Controls?

6 Answers  


What is acid in ado.net?

0 Answers  


Describe briefly an ADO.NET Dataset ?

0 Answers   Siebel,


what is a dataset?

9 Answers   Choice Solutions,


What is ado.net connection?

0 Answers  


Categories