![家基地图书馆馆藏数据库][1]
http://img715.imageshack.us/img715/1159/finallibrary.jpg
我正在为我的家庭图书馆开发一个小型图书数据库应用程序。我可以通过此命令在 sql server 2008 的多个相关表中插入记录 我不知道如何从 Visual Studio 2008 C# 或 vb、net 插入它 我想为书籍信息创建一个表单,我想从一种形式到数据库是可能的吗?请为我提供任何教程提前谢谢
DECLARE @bookid INT
DECLARE @authoridId INT
DECLARE @classid INT
DECLARE @catagaryid INT
DECLARE @publisherid INT
DECLARE @paddressid INT
BEGIN TRANSACTION
INSERT INTO dbo.author
( aname )
VALUES ( 'visnu priya singh' -- author_name - varchar(50)
)
SET @authoridId = @@IDENTITY
INSERT INTO dbo.class
( classname )
VALUES ( '12' -- classname - nvarchar(255)
)
SET @classid = @@IDENTITY
INSERT INTO dbo.catagary_main
( catagaryname )
VALUES ( 'networking' -- catagaryname - nvarchar(255)
)
SET @catagaryid = @@IDENTITY
INSERT INTO dbo.catagary_sub
( subcatagaryname ,
catagaryid
)
VALUES ( 'computer networking' , -- subcatagaryname - nvarchar(255)
@catagaryid -- catagaryid - int
)
INSERT INTO dbo.publisher
( pname ,
pconnumer
)
VALUES ( 'asian computek book' , -- pname - nvarchar(255)
'011232' -- pconnumer - nvarchar(255)
)
SET @publisherid = @@IDENTITY
INSERT INTO dbo.paadress
( p_house_no ,
parea ,
pstate ,
ppin_code
)
VALUES ( '7/001,first floor,' , -- p_house_no - nvarchar(255)
'ans road, ganj' , -- parea - nvarchar(255)
'delhi' , -- pstate - nvarchar(255)
'110002' -- ppin_code - nvarchar(255)
)
SET @paddressid=@@IDENTITY
INSERT INTO dbo.Publisher_aadresss
( publisherid, paddressid )
VALUES ( @publisherid, -- publisherid - int
@paddressid -- paddressid - int
)
INSERT INTO dbo.books
( book_name ,
authorid ,
yop ,
edition ,
price ,
isbn_number ,
classid ,
catagaryid ,
publisherid ,
Pages
)
VALUES ( 'computer networking course' , -- book_name - nvarchar(255)
@authoridId , -- authorid - int
2006 , -- yop - int
'first edition' , -- edition - nvarchar(255)
187.50 , -- price - int
'81-7317-9-7' , -- isbn_number - nvarchar(255)
@classid , -- classid - int
@catagaryid , -- catagaryid - int
@publisherid , -- publisherid - int
368 -- Pages - int
)
SET @bookid=@@IDENTITY
INSERT INTO dbo.book_written_by_author
( bookid, authorid )
VALUES ( @bookid, -- bookid - int
@authoridId -- authorid - int
)
COMMIT TRANSACTION