| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 739 人关注过本帖
标题:c#内嵌的SQL语句有点问题,麻烦大家看看
只看楼主 加入收藏
sdnd2000
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2008-4-10
收藏
 问题点数:0 回复次数:0 
c#内嵌的SQL语句有点问题,麻烦大家看看
小弟用C#做的一个系统, 内嵌的两条SQL语句老是过不了,不知道为什么,表里的名称,类型都检查了,还是不行。希望大家帮忙看看,我把这两条语句和所有建表的语句都发上来了,谢谢!!

select * from movie,transaction1,member where member.memberid=transaction1.memberid and transaction1.objectid=movie.objectid and transaction1.type='Rent' 
select * from movie,transaction1,member where member.memberid=transaction1.memberid and transaction1.objectid=movie.objectid and transaction1.type='Book
执行后报错如下:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'movie'.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'transaction1'.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'member'.

这是我的建表语句
程序代码:
USE filmdisk
CREATE TABLE STORE_OBJECT(
ObjectId varchar(10) primary key,
DailyCharge smallmoney,
)

CREATE TABLE VCR(
ObjectId varchar(10),
Brand varchar(20),
Model varchar(10),
VCRFeature varchar(10),
CONSTRAINT PK_VCR
        PRIMARY KEY(ObjectId),
CONSTRAINT FK_VCRSTOREObjectId
                FOREIGN KEY (ObjectId) REFERENCES STORE_OBJECT(ObjectId) 
ON UPDATE CASCADE
)

CREATE TABLE MOVIE(
ObjectId varchar(10),
Actor1 varchar(20),
Actor2 varchar(20),
Director varchar(20),
Title varchar(20),
Category varchar(20),
Producer varchar(20),
CONSTRAINT PK_MOVIE
        PRIMARY KEY(ObjectId),
CONSTRAINT MOVIESTOREObjectId
                FOREIGN KEY (ObjectId) REFERENCES STORE_OBJECT(ObjectId) 
ON DELETE CASCADE
ON UPDATE CASCADE
)
CREATE TABLE STORE(
StoreNo varchar(10) primary key,
SAddress varchar(30),
SPhone varchar(10)
)

CREATE TABLE FULL_TIME(
EmployeeId varchar(10),
Name varchar(20) not null,
Address varchar(30),
Phone varchar(10),
Salary decimal(10,5),
StoreNo varchar(10),
CONSTRAINT PK_FULL_TIME
        PRIMARY KEY(EmployeeId),
CONSTRAINT FULLSTORESNO
                FOREIGN KEY (StoreNo) REFERENCES STORE(StoreNo)
ON DELETE CASCADE
ON UPDATE CASCADE)

CREATE TABLE HOURLY(
EmployeeId varchar(10),
Name varchar(10) not null,
Address varchar(30),
Phone varchar(10),
Salary decimal(10,5),
CONSTRAINT PK_HOURLY
        PRIMARY KEY(EmployeeId)
)
CREATE TABLE MEMBER(
MemberId varchar(10),
Address varchar(30),
MemberName varchar(20)
CONSTRAINT PK_MEMBER
        PRIMARY KEY(MemberId)
)


CREATE TABLE TRANSACTION1(
TransactionId varchar(10) primary key,
Date Datetime,
Amount int,
Type varchar(10),
MemberId varchar(10),
StoreNo varchar(10),
CONSTRAINT TRANNUMFK
                FOREIGN KEY (StoreNo) REFERENCES STORE(StoreNo)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT MEMIDFK
                FOREIGN KEY (MemberId) REFERENCES MEMBER(MemberId)
ON DELETE CASCADE
ON UPDATE CASCADE
)


CREATE TABLE COPY(
ObjectId varchar(10),
CopyNo varchar(10),
Type varchar(10),
Status varchar(10) default 'in',
CONSTRAINT PK_COPY
        PRIMARY KEY(CopyNo,ObjectId),
CONSTRAINT COPYOBIDFK
                FOREIGN KEY (ObjectId) REFERENCES STORE_OBJECT(ObjectId) 
ON UPDATE CASCADE
)

CREATE TABLE HWORKS(
StoreNo varchar(10),
EmployeeId varchar(10) ,
Rate decimal(10,5),
Hours decimal(5,1),
CONSTRAINT PK_HWORKS
        PRIMARY KEY(StoreNo,EmployeeId),
CONSTRAINT HOUREMIDFK
                FOREIGN KEY (EmployeeId) REFERENCES HOURLY(EmployeeId) 
ON UPDATE CASCADE,
CONSTRAINT STORNUMFK
                FOREIGN KEY (StoreNo) REFERENCES STORE(StoreNo) 
ON UPDATE CASCADE
)

CREATE TABLE INVOLVES(
ObjectId varchar(10),
CopyNo varchar(10),
TransactionId varchar(10) ,
CONSTRAINT PK_INVOLVES
        PRIMARY KEY(ObjectId,CopyNo,TransactionId),

CONSTRAINT INVOCOOBFK
                FOREIGN KEY (CopyNo,ObjectId) REFERENCES COPY(CopyNo,ObjectId)
ON UPDATE CASCADE,
CONSTRAINT INVOTRANFK
                FOREIGN KEY (TransactionId) REFERENCES TRANSACTION1(TransactionId) 
ON UPDATE CASCADE,

)

CREATE TABLE NO_ASSIGNED(
ObjectId varchar(10),
StoreNo varchar(10) ,
NoDvd int,
NovHS int,
CONSTRAINT PK_NO_ASSIGNED
        PRIMARY KEY(ObjectId,StoreNo),
CONSTRAINT NOASINSNOFK
                FOREIGN KEY (StoreNo) REFERENCES STORE(StoreNo) 
ON UPDATE CASCADE,
CONSTRAINT NOASINOBIDFK
                FOREIGN KEY (ObjectId) REFERENCES MOVIE(ObjectId)
ON UPDATE CASCADE
)

CREATE TABLE VCR_DEVICE(
StoreNo varchar(10) ,
ObjectId varchar(10) ,
CopyNo varchar(10) ,
Type varchar(10),
Status varchar(5) default 'in',
CONSTRAINT PK_VCR_DEVICE
        PRIMARY KEY(StoreNo,ObjectId,CopyNo),
CONSTRAINT VCRNUMFK
                FOREIGN KEY (StoreNo) REFERENCES STORE(StoreNo)
ON UPDATE CASCADE
)
搜索更多相关主题的帖子: SQL 语句 麻烦 
2008-04-30 02:45
快速回复:c#内嵌的SQL语句有点问题,麻烦大家看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017095 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved