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
Is c# a strongly-typed language?
What is difference between the "throw" and "throw ex" in .net?
Why objects are stored in heap in c#?
What is serialization in dot net?
What are the variables in c#?
What is an expression in c#?
What is the difference between abstract and virtual?
Structs are not reference types. Can structs have constructors?
Which is the best language for desktop application?
What is readline library?
What does char mean in c#?
What does assert() do in c#?
What is “using” statement in c#?
how dot net compiled code will become platform independent?
What do you mean by streamreader/streamwriter class in c#?