hi first u do one thing drag the sql dataSource from tool kit once its draged to ur form u configure the sqldatasouce and it will navigate to some steps once u completed all the steps u can see connection string in the web config file as follows
In webconfig file follow the following code:
<connectionstrings>
<add name="EmployeeConnectionString" connectionstring="Data Source=.\SQLEXPRESS;Initial Catalog=dbEmployee;Persist Security Info=True;User ID=a;Password=b">
providerName="System.Data.SqlClient" />
</add></connectionstrings>
this is for windows authentication mode and once you find this copy the string in the invented commas as follows
in the class u copy as follows
using System.Data;
using System.Data.Sqlclient
class sample
{
protected void page_Load(object sender,EventArgs e)
{
string str="DataSource =the name of server;Initial Catalog=the name of ur database;Integrated Security=True";
try
{
sqlconnection con=new sqlconnection(str);
con.open();
string commandText="SQl query";
SqlCommand cmd=new Sqlcommand(commadnText,con);
cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
lable1.Text=ex.Message;
}
finally
{
con.Close();
}
}
}
try this and u can do it
[Edit: Added PRE tag]