Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server VB.NET
i have 3 tablese
table1 is tbl_members
table2 is tbl_library
table3 is tbl_borrowing
 
tbl_members hase this columns
 
idmebmer int autoincrement (primary key)
name varchar
adress varchar
tel varchar
email varchar
 
tbl_library hase this columns
idbook int autoincrement (primary key)
bookname varchar
bookauthor varchar
category varchar
 
tbl_borrowing hase this columns
 
idmebmer int autoincrement (primary key) 'this column is from foreign key from tbl_members '
 
idbook int autoincrement (foreign key) 'this column is from foreign key from tbl_library'

data_checkoutbook varchar ' the time where the user hase pickup the book from the library
data_retunbook varchar 'the time where the user must return the book to the library
 
i cane save data in table tbl_library and tbl_members but
how ken i save the date in tbl_borrowing for the user how has pick up a book
the user can only one book pick up

or how to i construk a database for a library menagment system

sorry for my english
Posted 2-Jan-13 4:11am
beniv1.7K
Comments
WajihaAhmed at 2-Jan-13 9:36am
   
Firstly, why you have auto-incremented the "idmebmer" and "idbook" in your "tbl_borrowing", any special reason?You just need an insert statement to acheive your goal.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If the user can only borrow one book, then I would be tempted to incorporate the loan details into the user, but...
Your system won't work while you have the columns set to autoincrement - you can't directly set those fields as they are updated by SQL server itself - any attempt to insert or update those values will give you an exception. Since they are suppose to refer to the Member and the Book, You should remove the autoincrement from them.
 
Personally, I'm not fond of autoincrement values for specific item ids - I prefer to use Guids as they can be set by the VB/C# code when the row is created, rather than created by the SQL and then the value has to be found in order to apply any functions to it.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 OriginalGriff 230
2 DamithSL 175
3 Dave Kreskowiak 120
4 Zoltán Zörgő 114
0 OriginalGriff 7,740
1 DamithSL 5,694
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,061
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100