Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 + MySql: Assign Primary Key to another field

Status
Not open for further replies.

mastertorr

Programmer
Dec 21, 2006
36
CA
Can anyone help in assisting me assign a primary key (auto number, int, not null) to another field which is varchar(5).

After my select i try setting the varchar field equal to the primary key field after the select statement like the following:

table!varchar = table!primary_key

But it tells me the primary _key value is null.

Any Suggestions?
Thanks
 
would you please do a SHOW CREATE TABLE tablename

VARCHAR columns cannot be used as an auto_increment

r937.com | rudy.ca
 
I figured this issue out....thank you though...

With the auto increment, the pk field didnt have a value until after the update statement, so i add to update, close, reopen the select statement and then set that value....works perfectly.
 
well you solved something that you didn't ask about but good for you for figuring it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top