Solved

Simple MYSQL VB Question ....

Posted on 2002-06-17
5
185 Views
Last Modified: 2010-05-18
TestTable has 2 columns i is an auto number the other is an integer value table..

If I do
adoconn.execute "Insert into TestTable(FIELD1), Values(123);"

how would i get the autonumber back out of the table?

0
Comment
Question by:AndySulz
  • 3
  • 2
5 Comments
 
LVL 2

Author Comment

by:AndySulz
ID: 7085264
FIELD0 IS THE AUTONUMBER FIELD AND FIELD1 IS THE INTEGER(3) COLUMNS
0
 
LVL 2

Accepted Solution

by:
GregJennings earned 50 total points
ID: 7085895
Try this:  "select LAST_INSERT_ID();"
It should return a recordset with a single row and single column containing the value last inserted into an AUTO_INCREMENT field for the current connection.
0
 
LVL 2

Author Comment

by:AndySulz
ID: 7086018
i actually figured it out a while ago.... but i will give you the points..
0
 
LVL 2

Expert Comment

by:GregJennings
ID: 7086040
Thanks.  Have you seen the MySQL docs?  They are in HTML in the "docs" folder under the main MySQL folder.
0
 
LVL 2

Author Comment

by:AndySulz
ID: 7086258
i read it at mysql.com
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question