Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
SqlConnection conn = new SqlConnection("Data Source=TWS\\SQLEXPRESS;Initial Catalog=db_umesh;Integrated Security=SSPI;");

Is this a correct string or not?
i taken this from connectionstrings.com but
my fully code is here but its not showing values in gridview please help me
thanks
SqlConnection conn = new SqlConnection("Data Source=TWS\\SQLEXPRESS;Initial Catalog=db_umesh;Integrated Security=SSPI;");
string qry = "select * from tbl_course";
SqlCommand cmd = new SqlCommand(qry, conn);
try
{
  cmd.Connection.Open();
  gv1.DataSource = cmd.ExecuteReader();
  gv1.DataBind();
}
catch (Exception ex)
{
  lblmsg.Text = ex.ToString();
}
finally
{
  conn.Close();
}
}

Thanks and regards,
Umesh Daiya :)
Posted
Updated 21-Feb-11 19:28pm
v4
Comments
JF2015 22-Feb-11 1:02am    
Added code formatting.

1 solution

What problem you are getting, please explain.

Here[^] you'll find correct connectionstring for your application.
 
Share this answer
 
Comments
RaviRanjanKr 22-Feb-11 1:50am    
Good Link!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900