代码如下:
m_strConnect="Provider=SQLOLEDB.1; Data Source=.; Initial Catalog=PDM3000; User ID=sa; PWD="
m_adoConnection.m_pConnection-> Open(_bstr_t(LPCTSTR(m_strConnect)), "", "", -1) m_adoCommand.SetConnection(&m_adoConnection);
CString strSQL;
strSQL.Format("insert Region values ('%s')",str);
m_adoCommand.SetCommandText(strSQL);
m_adoCommand.SetCommandType(adCmdText);
m_adoCommand.Execute(adCmdText); 在执行完上面的代码后,想用企业管理器打开Region表,但无法打开Region表,提示说连接超时。要关掉应用程序之后才能打开,而且没有插入成功。
不知道是什么原因?请各位帮帮小弟?
m_strConnect="Provider=SQLOLEDB.1; Data Source=.; Initial Catalog=PDM3000; User ID=sa; PWD="
m_adoConnection.m_pConnection-> Open(_bstr_t(LPCTSTR(m_strConnect)), "", "", -1) m_adoCommand.SetConnection(&m_adoConnection);
CString strSQL;
strSQL.Format("insert Region values ('%s')",str);
m_adoCommand.SetCommandText(strSQL);
m_adoCommand.SetCommandType(adCmdText);
m_adoCommand.Execute(adCmdText); 在执行完上面的代码后,想用企业管理器打开Region表,但无法打开Region表,提示说连接超时。要关掉应用程序之后才能打开,而且没有插入成功。
不知道是什么原因?请各位帮帮小弟?
m_adoCommand.SetCommandType(adCmdText);
这2条的次序要颠倒。
最后还要处理连接的关闭情况。
m_adoCommand.SetCommandType(adCmdText);
这2条的次序要颠倒。
最后还要处理连接的关闭情况。
=========
顺序没错吧。