以下是程序的一部分 前面都已经创建了库和文件一直编写到以下表的时候提示错误:
服务器: 消息 213,级别 16,状态 4,行 1
插入错误: 列名或所提供值的数目与表定义不匹配。
服务器: 消息 213,级别 16,状态 1,行 1
插入错误: 列名或所提供值的数目与表定义不匹配。
服务器: 消息 213,级别 16,状态 1,行 1
插入错误: 列名或所提供值的数目与表定义不匹配。
服务器: 消息 213,级别 16,状态 1,行 1
插入错误: 列名或所提供值的数目与表定义不匹配。
create table bbsUser
(
UID int identity(1,1)  primary key,      -用户ID
Uname varchar(20)  not null ,           --用户名
Upassword varchar(20) not null default '888888' check(len(Upassword)>=6),         --密码
Uemail varchar(30) check(Uemail like '%@%'),  --邮箱
Usex bit not null default 1,  --性别
Uclass int  default 0 ,   --用户等级
Ure varchar(30),  --备注信息
Uregdate datetime not null default getdate(),  --注册时期
Ustate int default 0,  --状态
Upoint int default 2                  --用户积分
)
 /*************************len()为求长度 的函数***********************************//*插入数据与建表时候的字段顺序一致,但是添加约束的顺序可以与建表字段同*/insert into BBSUser values('可卡因','HYXS007','[email protected]',1,1,'我要去公安局自首','2003-08-13',1,200)
insert into BBSUser values('心酸果冻','888888','[email protected]',0,2,'牵皮瘦马闯天涯','2004-09-13',2,600)
insert into BBSUser values('冬篱儿','fangdong','[email protected]',1,3,'爱迷失在天堂','2004-07-13',4,1200)
insert into BBSUser values('Supper','master','[email protected]',1,5,'BBS在斑竹','2005-06-13',1,5000)

解决方案 »

  1.   

    insert into BBSUser(Uname,
    Upassword ,
    Uemail,
    Usex,
    Uclass,
    Ure,
    Uregdate,
    Ustate,
    Upoint)
     values('可卡因','HYXS007','[email protected]',1,1,'我要去公安局自首','2003-08-13',1,200)
      

  2.   

    create table bbsUser
    (
    UID int identity(1,1)  primary key,      --用户ID
    Uname varchar(20)  not null ,           --用户名
    Upassword varchar(20) not null default '888888' check(len(Upassword)>=6),         --密码
    Uemail varchar(30) check(Uemail like '%@%'),  --邮箱
    Usex bit not null default 1,  --性别
    Uclass int  default 0 ,   --用户等级
    Ure varchar(30),  --备注信息
    Uregdate datetime not null default getdate(),  --注册时期
    Ustate int default 0,  --状态
    Upoint int default 2                  --用户积分
    )
    insert into BBSUser values('可卡因','HYXS007','[email protected]',1,1,'我要去公安局自首','2003-08-13',1,200)
    insert into BBSUser values('心酸果冻','888888','[email protected]',0,2,'牵皮瘦马闯天涯','2004-09-13',2,600)
    insert into BBSUser values('冬篱儿','fangdong','[email protected]',1,3,'爱迷失在天堂','2004-07-13',4,1200)
    insert into BBSUser values('Supper','master','[email protected]',1,5,'BBS在斑竹','2005-06-13',1,5000)
    (所影响的行数为 1 行)
    (所影响的行数为 1 行)
    (所影响的行数为 1 行)
    (所影响的行数为 1 行)----------------------------
    我的美问题...
    你的 注释 uid 的时候 少了 -
    -----------
    服务器: 消息 213,级别 16,状态 1,行 1
    插入错误: 列名或所提供值的数目与表定义不匹配。----------
    这个错误是:你插入的数据列 与表  不一致