首页上一页 1 下一页尾页 1 条记录 1/1页
<>房屋中介系统遇到试图问题来请教大家
发表在C#图书答疑
2008-12-12
是否精华
是
否
版块置顶:
是
否
create table tb_house
(
houser_ID int primary key not null,
house_companyName varchar(10) null,
house_typeID varchar(10) null,
house_seatID varchar(10) null,
house_state varchar(10) null,
house_fitmentID varchar(10) null,
house_favorID varchar(10) null,
house_mothedID varchar(10) null,
house_map varchar(10) null,
house_price numeric(18,0) null,
house_florrID varchar(10) null,
house_buildYear varchar(10) null,
house_area varchar(20) null,
house_remark varchar(50) null,
User_IDS varchar(10) null,
)
insert into tb_house(houser_ID ,house_companyName ,house_typeID ,house_seatID ,house_state,
house_fitmentID ,house_favorID ,house_mothedID ,house_map ,house_price ,house_florrID ,
house_buildYear ,house_area ,house_remark ,User_IDS )
values('1001','物业A','typ1002','sea1001','remark','fit1001','fav1001',
'mot1001','400','400','flo1001','10','200','无','lend1001')
select * from tb_house
drop table tb_favor
create table tb_favor
(
house_favor varchar(10) primary key,
favor_name varchar(20) null,
favor_remark varchar(50) null,
)
insert into tb_favor(house_favor,favor_name,favor_remark)values('1001','东','')
create table tb_fitment
(
house_fitmentID varchar(10) primary key,
fitment_name varchar(20) null,
fitment_remark varchar(50) null,
)
insert into tb_fitment(house_fitmentID,fitment_name,fitment_remark)values('fit1001','很好','有电脑')
select * from tb_fitment
create table tb_floor
(
house_floorID varchar(10) not null,
floor_name varchar(20) null,
floor_remark varchar(50) null,
)
insert into tb_floor(house_floorID,floor_name,floor_remark) values('flo1001','一层','')
select * from tb_floor
create table tb_mothed
(
house_mothedID varchar(10) primary key not null,
moehed_name varchar(20) null,
mothed_remark varchar(50) null,
)
insert into tb_mothed(house_mothedID,moehed_name,mothed_remark)values('mot1001','民用','')
select * from tb_mothed
create table tb_seat
(
house_seatID varchar(10) primary key not null,
seat_name varchar(20) null,
seat_remark varchar(50) null,
)
insert into tb_seat(house_seatID,seat_name,seat_remark)values('sea1001','B座','')
select * from tb_seat
create table tb_type
(
huost_typeID varchar(10) primary key not null,
type_names varchar(20) null,
type_remark varchar(50) null,
)
insert into tb_type(huost_typeID,type_names,type_remark)values('typ1001','一室一厅','')
select * from tb_type
create view view_house
as
select tbho.houser_ID 房屋编号,tbho.house_companyName 物业名称,tbho.house_area 建筑面积,
tbho.house_buildYear 建筑年限,tbho.house_price 价钱,tbfa.favor_name 朝向,
tbfi.fitment_name 装修,tbfl.floor_name 楼层,tbmo.house_mothedID 用途,tbse.seat_name 幢座,
tbty.type_names 类型,tbho.house_state 状态,tbho.User_IDS 用户编号
from tb_house tbho,tb_favor tbfa, tb_fitment tbfi, tb_floor tbfl, tb_mothed tbmo,tb_seat tbse,tb_type tbty
where
tbho.house_typeID = tbty.huost_typeID and
tbho.house_seatID = tbse.house_seatID and
tbho.house_fitmentID = tbfi.house_fitmentID and
tbho.house_favorID = tbfa.house_favor and
tbho.house_mothedID = tbmo.house_mothedID and
tbho.house_florrID = tbfl.house_floorID
select * from view_house
这是我创建一个主表和几个次表 我用的是试图,但是多执行成功了可是里面就没有数据,这是为什么呢?难道试图也要用insert into 添加数据不成,
可是换过来一想,我表中的字段里面已经有数据了,因该不用吧。
但是我运行 select * from view_house 里面就是空的。我特意向大家请教,谢谢各位
(
houser_ID int primary key not null,
house_companyName varchar(10) null,
house_typeID varchar(10) null,
house_seatID varchar(10) null,
house_state varchar(10) null,
house_fitmentID varchar(10) null,
house_favorID varchar(10) null,
house_mothedID varchar(10) null,
house_map varchar(10) null,
house_price numeric(18,0) null,
house_florrID varchar(10) null,
house_buildYear varchar(10) null,
house_area varchar(20) null,
house_remark varchar(50) null,
User_IDS varchar(10) null,
)
insert into tb_house(houser_ID ,house_companyName ,house_typeID ,house_seatID ,house_state,
house_fitmentID ,house_favorID ,house_mothedID ,house_map ,house_price ,house_florrID ,
house_buildYear ,house_area ,house_remark ,User_IDS )
values('1001','物业A','typ1002','sea1001','remark','fit1001','fav1001',
'mot1001','400','400','flo1001','10','200','无','lend1001')
select * from tb_house
drop table tb_favor
create table tb_favor
(
house_favor varchar(10) primary key,
favor_name varchar(20) null,
favor_remark varchar(50) null,
)
insert into tb_favor(house_favor,favor_name,favor_remark)values('1001','东','')
create table tb_fitment
(
house_fitmentID varchar(10) primary key,
fitment_name varchar(20) null,
fitment_remark varchar(50) null,
)
insert into tb_fitment(house_fitmentID,fitment_name,fitment_remark)values('fit1001','很好','有电脑')
select * from tb_fitment
create table tb_floor
(
house_floorID varchar(10) not null,
floor_name varchar(20) null,
floor_remark varchar(50) null,
)
insert into tb_floor(house_floorID,floor_name,floor_remark) values('flo1001','一层','')
select * from tb_floor
create table tb_mothed
(
house_mothedID varchar(10) primary key not null,
moehed_name varchar(20) null,
mothed_remark varchar(50) null,
)
insert into tb_mothed(house_mothedID,moehed_name,mothed_remark)values('mot1001','民用','')
select * from tb_mothed
create table tb_seat
(
house_seatID varchar(10) primary key not null,
seat_name varchar(20) null,
seat_remark varchar(50) null,
)
insert into tb_seat(house_seatID,seat_name,seat_remark)values('sea1001','B座','')
select * from tb_seat
create table tb_type
(
huost_typeID varchar(10) primary key not null,
type_names varchar(20) null,
type_remark varchar(50) null,
)
insert into tb_type(huost_typeID,type_names,type_remark)values('typ1001','一室一厅','')
select * from tb_type
create view view_house
as
select tbho.houser_ID 房屋编号,tbho.house_companyName 物业名称,tbho.house_area 建筑面积,
tbho.house_buildYear 建筑年限,tbho.house_price 价钱,tbfa.favor_name 朝向,
tbfi.fitment_name 装修,tbfl.floor_name 楼层,tbmo.house_mothedID 用途,tbse.seat_name 幢座,
tbty.type_names 类型,tbho.house_state 状态,tbho.User_IDS 用户编号
from tb_house tbho,tb_favor tbfa, tb_fitment tbfi, tb_floor tbfl, tb_mothed tbmo,tb_seat tbse,tb_type tbty
where
tbho.house_typeID = tbty.huost_typeID and
tbho.house_seatID = tbse.house_seatID and
tbho.house_fitmentID = tbfi.house_fitmentID and
tbho.house_favorID = tbfa.house_favor and
tbho.house_mothedID = tbmo.house_mothedID and
tbho.house_florrID = tbfl.house_floorID
select * from view_house
这是我创建一个主表和几个次表 我用的是试图,但是多执行成功了可是里面就没有数据,这是为什么呢?难道试图也要用insert into 添加数据不成,
可是换过来一想,我表中的字段里面已经有数据了,因该不用吧。
但是我运行 select * from view_house 里面就是空的。我特意向大家请教,谢谢各位