发布网友 发布时间:2024-10-24 09:55
共2个回答
热心网友 时间:2024-10-30 15:01
try
{
strConnection = "server=(local);database=HRManager;integrated security=SSPI";
conn.Open();
conn = new SqlConnection();
conn.ConnectionString = strConnection;
// conn.Open();
}
你把第一个conn.open()去掉,因为这个时候你还没有初始化conn呢~~
热心网友 时间:2024-10-30 14:57
conn.Open();
conn = new SqlConnection();
conn.ConnectionString = strConnection;
顺序有问题
conn.Open();放下边试试