创建连接

来源:互联网 发布:宿城区网络问政 编辑:程序博客网 时间:2024/04/28 00:45
 string name = ConfigurationManager.ConnectionStrings["sqlname"].ConnectionString;
            SqlConnection conn = new SqlConnection(name);
            conn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;
            //SqlCommand cmd = conn.CreateCommand();