Display an Autonumber from MySql in a textbox with Visual Basic?

SELECT MAX(itID)+1 AS Expr1 FROM(TableName) Is a bad idea, you will run into concurrency issues very quickly You should run the following SQL statements instead INSERT INTO tablename (ID, morefields) VALUES (NULL, real_values_or_place_holders); SELECT LAST_INSERT_ID() as NewTicketID; -- After the ticket is complete UPDATE tablename SET morefields = WHERE id = NewTicketID -- If the ticket gets cancelled: DELETE FROM tablename WHERE id = NewTicketID If you do it like that you will never run into issues with duplicate or wrong TicketID being issued If you do a select you cannot say it's a nonQuery Use the following code Dim cmd As New SqlCommand() cmd. Connection = conn cmd. CommandText = "SELECT LAST_INSERT_ID() AS NewTicketID" Dim reader As SqlDataReader = cmd.ExecuteReader() reader.

Read MsgBox(reader("NewTicketID")).

SELECT MAX(itID)+1 AS Expr1 FROM(TableName)" Is a bad idea, you will run into concurrency issues very quickly. You should run the following SQL statements instead. INSERT INTO tablename (ID, morefields) VALUES (NULL, real_values_or_place_holders); SELECT LAST_INSERT_ID() as NewTicketID; -- After the ticket is complete UPDATE tablename SET morefields = WHERE id = NewTicketID -- If the ticket gets cancelled: DELETE FROM tablename WHERE id = NewTicketID If you do it like that you will never run into issues with duplicate or wrong TicketID being issued.

If you do a select, you cannot say it's a nonQuery. Use the following code Dim cmd As New SqlCommand() cmd. Connection = conn cmd.

CommandText = "SELECT LAST_INSERT_ID() AS NewTicketID" Dim reader As SqlDataReader = cmd.ExecuteReader() reader. Read MsgBox(reader("NewTicketID")).

ExecuteReader' is not a member of 'String' is the syntax error I'm receiving – MDL Oct 4 at 16:44 Also, I understand that I have to insert null values at first and then I can update them after but you lost me when you got to the section under "use the following code" – MDL Oct 4 at 16:57 I have to insert null values at first and then I can update them after that's correct, insert nulls first, then select last_insert_id() then update (or delete). The code snippet shown is for the select. – Johan Oct 4 at 18:09 can you check my above revisions in the 2nd code table^ – MDL Oct 4 at 19:10 @MDL, They are not correct.

Read up on the official docs (and the examples therein) here:msdn.microsoft. Com/en-us/library/… and here: msdn.microsoft. Com/en-us/library/… – Johan Oct 4 at 19:19.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions