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

Hoe can i connect the table into the c# application?

Answer Posted / umesh shrivastava

if we are using web application
1-open web.config file
<ConnectionString>
<add name="connect" connectionstring="Data Source=
,IntialCatalog= " Username= ,Password=
;providerName="System.Data.SqlClient"
</ConnectionString>
2-write namespace at the top in .cs file System.Data.SqlClient;
2-now write this code to button click event
String
ss=ConfigurationManager.ConnectionString["connect"].ConnectionString;
Sqlconnection con=new SqlConnection(ss);
con.open();
SqlCommand cmd=new SqlCommand("select * from emp",con);
SqlDataReader r=cmd.ExecuteReader();
con.close();

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I create a delegate/multicastdelegate?

982


Can we write class inside a class in c#?

942


How can you achieve run time polymorphism in C#?

994


What is the main usage of keyword “virtual” ? How does it work for a method or property?

897


Why do we use yield in c#?

895


Define delegate?

945


What do you mean by delegates and explain different types of delegates?

940


What is default access modifier for class in c#?

1005


Is inheritance possible in c sharp?

1028


How many types of delegates are there in c#?

939


What is enumerable in c#?

867


How do you remove white spaces from a string?

918


What is the difference between const and readonly in c#.net?

926


What is deferred execution?

873


Can properties be overloaded in c#?

944