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
What does the dispose method do with the connection object?
Define satellite assembly in c#?
What is namespace in oops?
Define a partial class?
Can you create sealed abstract class in c#?
What is action c#?
What is the difference between iqueryable and ienumerable?
What does using do in c#?
Explain about Destructor method?
What is yield c#?
What is the purpose of a namespace?
Which program construct must return a value?
What does == mean in c sharp?
What is disco?
What is difference between for and foreach in c#?