日期:2014-05-17 浏览次数:20741 次
BOOL CConnectDataBase::CreateTable(CString _tableName)
{
if(IsHaveTable(_tableName))
{
AfxMessageBox("数据库表已经存在!");
return FALSE;
}
try
{
_variant_t _value;
CString strSQL = _T("CREATE TABLE ");
strSQL += _tableName;
strSQL += _T("(PJType NCHAR(20),PJLevel NCHAR(20),PJDscribe NTEXT,Pic IMAGE)");
//建表
//m_pConnect->Execute("CREATE TABLE _tableName(PJType NCHAR(20),PJLevel NCHAR(20),PJDscribe NTEXT,Pic IMAGE)", &_value, adCmdText);
m_pConnect->Execute((_bstr_t)strSQL, &_value, adCmdText);
}
catch (_com_error& e)
{
AfxMessageBox(e.Description());
}
}
CConnectDataBase* m_pConect;
m_pConnect->CreateTable("DL/T 773-2001");
_variant_t _value;
CString strSQL = _T("CREATE TABLE ");
strSQL += _tableName;
strSQL += _T("(PJType NCHAR(20),PJLevel NCHAR(20),PJDscribe NTEXT,Pic IMAGE)");
_variant_t _value;
CString strSQL = _T("CREATE TABLE [");
strSQL += _tableName;
strSQL += _T("](PJType NCHAR(20),PJLevel NCHAR(20),PJDscribe NTEXT,Pic IMAGE)");