Re: Save to database + get ID of latest input..

Well, obviously without actual sql statements it's quite difficult to figure out what is supposed to happen.

But I can see a few issues straight away.

1. Parameter marker in mysql is not @ sign but a ? mark instead.

2. It seems that you try to execute a single sql query in 2 different ways (not sure what it's for). If your sql statement was an insert and you need to get autoincrement value, then you'd better use
myCommand.InsertId property.

Re: Save to database + get ID of latest input..

When it comes to the true or false question, that comes into place in another class where it decides if something should get allocated a new object or not.. You can say that, that method is used for storing to a database and it's suppose to do that twice.
If the same method returns true twice then it will be sent back "through the chains" of the application/solution that it did and the shoppingcart will be emptied..

When it comes to @ statement.. I chose that because the course literature states that. (Beginning ASP.NET 3.5 in C# 2008 - Page 523)

2. It seems that you try to execute a single sql query in 2 different ways (not sure what it's for).2 different ways?
IF you are thinking about myCommand.ExecuteNonQuery, from what I've read that is the whole insertion into the database
and mCustomerID is to get the latest ID of the table where my information was last inserted into.

Re: Save to database + get ID of latest input..

i have a form1 which include information about a custumer and i have to save an image in database (SQL server) for each one and i need to get the ID of latest input that i can save it because i should passed to the next form

my probelm is that evry time i run when i check the table image i found my image added but when i check the table product the reference of the id of image is always = '0000'

pls how can i solve it.. even i tried to add this line ' int ID = (int)command.LastInsertedId'; // ===> i get erreur that a using directive or assembly reference is missed !!!!!<===