C#怎样连接数据库啊,请教一下各位前辈
我用C#连接数据库用那个查询语句连上了,但C#总是报错
string connection = "DataSource=....;";//这个自己去查或者在web.config中配置ConnectionSection
//string connection = ConfigurationManager.ConnectionStrings["数据库连接名"].ConnectionString;
SqlConnection con = new SqlConnection(connection);
con.Open();
string sqlstring = "";
SqlCommand command = new SqlCommand(sqlstring, con);
SqlDataReader reader = command.ExcuteReader();
大概就是这样了