views:

23

answers:

1

I am trying to figure out how to use ADO and ADODB to get data and view it while also being able to determine the PK so that I can alter data.

My plan is to use ADODB to display some data to an end user in Excel, if the user wants to edit the data there will be a macro monitoring cell changes and then sending the change to the database. I need a way to use ADOX to find the keys and alter the data unless I can use ADOX to query and alter the data all in one.

I have experience working with ADODB to communicate with a MySQL database and I know that ADOX can show you keys for database tables and also allows you to easily change the database structures. I can't seem to find anything with regards to what I am trying to do.

A: 

I don't know how much support adox has for mysql. I think it is highly dependent on the driver you are using.

You may be able to query the mysql metadata to locate the primary key info via adodb. see this q for syntax: http://stackoverflow.com/questions/893874/mysql-determine-tables-primary-key-dynamically

bugtussle
Well I wasn't aware of the SHOW Index but I had the same idea as someone else in that post. I just didn't want to have to dig around in the information_schema for the data because you have to deal with the column name, the ordinal number, the sub portion etc and it seemed like reinventing the wheel if ADOX would do it for me. I do like the query the second poster posted so I think I'll try to do that in the mean time. Thanks.
Geoff