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
Why do we need interface in c#?
Is java better than c#?
What is a callback c#?
What are fields in c#?
What kind of the information stored inside the assembly?
Why abstract class can not be instantiated?
Is unity object oriented?
What is jagged array?
What is an arraylist in c#?
Which is executed if an exception has not occurred?
Define delegation in .net?
Is there a way of specifying which block or loop to break out of when working with nested loops?
Which namespace is required to implement trace ?
What's different between c# and c/c++?
Can you store strings in arrays?