Skip to content
Advertisement

Member’s books in possession in Library System

Hello I am currently working into a library system and I do want to view how many books are in possession of a specific member.

I want to add a copies to student whenever I issue a book to them.

I have tried:

but it doesn’t insert into members row, instead it shows

I have also tried:

But doesn’t work either.

I don’t know how to fix this so any help would be appreciated. Or is there anyway how to achieve this?

Advertisement

Answer

If you want to insert a new record:

If you want to update an existing record, as opposed to inserting a new one, use this code:

Also, it’s not recommended to use AddWithValue for strings. Instead you should prepare values like so:

Where VarChar is the type of the field in the database, and 30 is the maximum length of the field in the database. From this code I would expect to see VARCHAR(30).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement