22,209
社区成员
发帖
与我相关
我的任务
分享
using (SqlConnection cn = new SqlConnection(strDBName))
{
cn.Open();
if (cn.State == ConnectionState.Open)
{
//SqlCommand cmd = m_SqlCommandPool.Pop();
try
{
objSQLCommand.Connection = cn;
objSQLCommand.CommandText = strSQL;
objSQLCommand.CommandType = CommandType.Text;
objSQLCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
CDebug.Print(ex.ToString() + "\r\n" + sqlTask.Command);
}
finally
{
//释放对连接的引用
objSQLCommand.Connection = null;
// m_SqlCommandPool.Push(cmd);
}
}
}