连接sql数据库步骤:
1. vs10 -> Tools -> Connect to Database ->Microsoft SQL Server -> 填写Server name : Use SQL Server Authentication (常用方式):Select or enter a database name -> OK
2. 在Server Explorer 中选择连到的数据库右键选属性获取连接字符串。
3. 在webconfig中创建AppSetting节点key为connectionAWGDB值为连接字符串
private SqlConnection _getConnection()
//得到连接对象
{
try
{
}catch(Exception exception){
}
}
private SqlCommand _getCommand(string sqlString, SqlConnection sqlConnection) //得到sql命令对象
{ </