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
Define a class and an object?
What are the different types of constructors in c#?
If you define a user defined data type by using the class keyword, is it a value type or reference type?
Wcf and what is difference between wcf and web services?
What is the difference between static and constant variables?
Why do we need interfaces in c#?
Explain the process of Serialization?
What is a sealed class?
What is the use of ienumerable?
What is the full form of GAC? Explain its uses?
What is the wildcard character in sql?
What is the difference between interface and abstract class in c#?
Explain about Error handling and how this is done
In which way a two-dimensional array declared in C#?
Which class comes after the SortedList class?