Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Developers, I am having a problem I am working on a Library Management System using C#(WPF) and SQL. i am having am Admin Panel and Student Panel So from the Admin panel i will add books to the book database (BooksTbl) and in Student panel it will be listed by using datagrid so the question is how are the student gonna add the book to their student database(StudentsTbl) i have created a database that insert all books that have been added by students and will be visible in admin panel by who and the time that been added

IssuedBooks = Table for books that will be added from students
BookTbl = Main Books Table

What I have tried:

string mySQL = string.Empty;
           mySQL += "INSERT INTO IssuedBooksTbl (Book_ID, Book_Name, RemainingQuantity,)";
           mySQL += "SELECT Book_ID, Book_Name, Quantitiy FROM BookTbl WHERE Book_ID='" + IDTxt.Text +"'";
           mySQL += "INSERT INTO IsuuedBooksTbl (IssuedBy = '" + Loginscreen.recBy + "', IssuedTime = '" + DateTime.Now + "')";
           Connection.LibraryBooksServer.executeSQL(mySQL);

           System.Windows.MessageBox.Show("Book Added");
Posted
Updated 14-May-21 17:37pm
Comments
[no name] 14-May-21 14:40pm    
I don't think you've spent enough time thinking about "the life of a library book". You're throwing something together and hoping it will stick.
Omar Dakelbab 14-May-21 15:10pm    
You have talked so much you know that right, i want a solution not a empty words
W Balboos, GHB 14-May-21 15:58pm    
You see to have the feeling that Mr. Schmitz owes you a solution. You are asking him - and all who read this, for help you . . . for free, too.

From your series of questions on this same subject it seems you want it done for you: ideas then code. Posting a nasty reply won' get you much help.
FranzBe 14-May-21 15:32pm    
I agree with Gerry Schmitz, what you wrote is not a good question. And your comment 'I want a solution' is not the right approach. If you are stuck at some point, I will try to help and get you over that (others will do as well and probably better than me) but I wont spent any time to give you a "solution" to that tiny "What I have tried" section you provided.
FranzBe 14-May-21 15:38pm    
By the way, this question is just a variant of that one: https://www.codeproject.com/Questions/5302621/How-do-I-do-a-system-that-user-can-login-and-add-b

1 solution

I could grasp that you're trying to relate existing data from BooksTbl to currently LoggedIn User in that new table called IssuedBooksTbl. So, Did you consider a many-to-many relationship between BooksTbl and StudentsTbl?
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900