S
small518
Unregistered / Unconfirmed
GUEST, unregistred user!
use master
if exists (select * from dbo.sysdatabases where name ='kc13')
drop database kc13
create database kc13
use kc13
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[仓位目录]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[仓位目录]
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[入库单]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[入库单]
CREATE TABLE [dbo].[仓位目录] (
[流水号] [int] IDENTITY (1, 1) NOT NULL ,
[名称] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[位置] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[管理员] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[备注] [text] COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
CREATE TABLE [dbo].[入库单] (
[流水号] [int] IDENTITY (1, 1) NOT NULL ,
[单据编号] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[原始单据] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[日期] [datetime] NULL ,
[入库原因] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[制单] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[经办人] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[红冲] [bit] NULL ,
[供货单位] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[调拨] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
上面是我的脚本,我用控件ADOCommand
this->ADOCommand1->Parameters->Clear();
this->ADOCommand1->Connection="Provider=SQLOLEDB.1;Password='"+strPWD+"';Persist Security Info=false;User ID='"+strName+"';Data Source='"+strServer+"'";
this->ADOCommand1->CommandText=this->Memo1->Tex;//上面脚本
this->ADOCommand1->Execute();
如果我把"use kc13"去掉的话,可以建库和表,但是表却建到"master"下了,这样肯定不行,
但是加上"use kc13"后,库和表都不能建了,是什么原因啊?
哪位大侠指点一下啊?
if exists (select * from dbo.sysdatabases where name ='kc13')
drop database kc13
create database kc13
use kc13
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[仓位目录]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[仓位目录]
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[入库单]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[入库单]
CREATE TABLE [dbo].[仓位目录] (
[流水号] [int] IDENTITY (1, 1) NOT NULL ,
[名称] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[位置] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[管理员] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[备注] [text] COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
CREATE TABLE [dbo].[入库单] (
[流水号] [int] IDENTITY (1, 1) NOT NULL ,
[单据编号] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[原始单据] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[日期] [datetime] NULL ,
[入库原因] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[制单] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[经办人] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[红冲] [bit] NULL ,
[供货单位] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[调拨] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
上面是我的脚本,我用控件ADOCommand
this->ADOCommand1->Parameters->Clear();
this->ADOCommand1->Connection="Provider=SQLOLEDB.1;Password='"+strPWD+"';Persist Security Info=false;User ID='"+strName+"';Data Source='"+strServer+"'";
this->ADOCommand1->CommandText=this->Memo1->Tex;//上面脚本
this->ADOCommand1->Execute();
如果我把"use kc13"去掉的话,可以建库和表,但是表却建到"master"下了,这样肯定不行,
但是加上"use kc13"后,库和表都不能建了,是什么原因啊?
哪位大侠指点一下啊?