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?

Answers were Sorted based on User's Feedback



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

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

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

Answer / gaurav

by writing the connection string on the click event of the
button. by connection string i mean it's the ado.net
structure.firstly you have to include the namespace- using
system.data.sqlclient;
now on the click event of the button( eg u have taken a
sumbit button ) you will be writting- sqlconnenection con=
new sqlconnection........then u'll use
datacommand,dataset,string,databind,gridview.
u can also use read for getting the errors in a specified
manner.for this u will be using try and the catch then your
connection string code and then u'll use the finally
function and then close().

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Sharp Interview Questions

Explain get and set accessor properties?

0 Answers  


Explain circular reference in c#?

0 Answers  


How will you deploy the dll file in gac?

0 Answers  


What does the keyword “virtual” declare for a method or property?

0 Answers   Siebel,


What is default access specifier for class in c#?

0 Answers  


localization using windows c#

2 Answers  


Can we inherit partial class in c#?

0 Answers  


Why do we need constructor in c#?

0 Answers  


what is scope of a protected internal member variable of a c# class

0 Answers   Cognizant,


How assembly versioning in .NET prevent DLL Hell problem?

0 Answers   DELL,


What is the difference between array.find method and arraylist.find method?

1 Answers   Mphasis,


Is there any way to access private memebers of an object from another object?

4 Answers   TCS,


Categories