用VC语句一次向Sql Server数据库中添加多个表的问题
发表在C语言图书答疑
2007-03-20
是否精华
是
否
版块置顶:
是
否
我用下面方法添加了Mta表很成功,但添加多个表时就不行了,请提示一下!
_bstr_t strConn="Provider=SQLOLEDB;Password=;User ID=sa;Data Source=";
CString strCreateTable("USE master
CREATE TABLE dbo.Mta (
mtaName varchar (50) ,
dataName varchar (50) COLLATE Chinese_PRC_CI_AS NULL))");
try
{
m_pConnection.CreateInstance(__uuidof(Connection));
m_pConnection->Open(strConn,"","",adModeUnknown);
m_pConnection->Execute(_bstr_t((LPCTSTR)strCreateTable),NULL,adExecuteNoRecords);
}
_bstr_t strConn="Provider=SQLOLEDB;Password=;User ID=sa;Data Source=";
CString strCreateTable("USE master
CREATE TABLE dbo.Mta (
mtaName varchar (50) ,
dataName varchar (50) COLLATE Chinese_PRC_CI_AS NULL))");
try
{
m_pConnection.CreateInstance(__uuidof(Connection));
m_pConnection->Open(strConn,"","",adModeUnknown);
m_pConnection->Execute(_bstr_t((LPCTSTR)strCreateTable),NULL,adExecuteNoRecords);
}