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
How do I create a delegate/multicastdelegate?
Can we write class inside a class in c#?
How can you achieve run time polymorphism in C#?
What is the main usage of keyword “virtual†? How does it work for a method or property?
Why do we use yield in c#?
Define delegate?
What do you mean by delegates and explain different types of delegates?
What is default access modifier for class in c#?
Is inheritance possible in c sharp?
How many types of delegates are there in c#?
What is enumerable in c#?
How do you remove white spaces from a string?
What is the difference between const and readonly in c#.net?
What is deferred execution?
Can properties be overloaded in c#?