Hi Rcfearn,
Well, based on my experience, I think the solution depends on the design of your database tables.
If you have defined “Pets�table with columns like following:
|
PetID |
PetsName |
ClientID or ClientName |
|
|
|
|
You can find pets info without using Pet’s ID. Instead, it can be found by the combination of Pet’s Name and ClientID, since ClientID is unique in database and different pets of the same client must have different names too.
But, if you defined “Pets�table like this:
I’m afraid it is difficult to get PetId under your situation.
I have to say that it’s not the best design, which may weaken the relation between “Pets�table and “Client�table.
If tables are defined like that, maybe you can get PetID like the following steps:
1. When you load data into datagridview, create another datatable which has the schema like the former design I listed above. Let’s call it Temp_Pet_Table
2. Each time user clicks the ComboBox column to choose a pet, generate a select command to find pet info in Temp_Pet_Table.
Then pet’s info could be found.
Hope it helps.
Please feel free to let me know how it your problem is going on. If there is any question, please feel free to rise, and I’ll try to give you solution as I can.
Best wishes,
Jun Wang