Metal Paw
Metal Paw

Reputation: 152

Get The Properties From A Dataset Query

I have a dataset - ImageDataSet.xsd - that has a datatable in it - Colour - with it's relating tableadapter - ColourTableAdapter -. This ColourTableAdapter has a custom query added to it - FillByColourID - that is linked to the database stored procedure - Colour_SelectByColourID -.

If I only have access to the table adapter and the name of the query, so ColourTableAdapter and FillByColourID, how could I possibly get the stored procedure name? I have gotten as far as retrieving the correct MethodInfo to invoke but I need to know the stored procedure name as well.

Looking at the query in the xsd file, I see there are properties that list the FillMethodName and the CommandText, which is the method I need to invoke on the adapter and the stored procedure name that I am looking for, but I don't know how to get to those properties. I have looked through the adapter using reflection but I can't seem to find the correct properties to give me this information.


Edit:

I need the stored procedure name as I have a running SqlConnection and SqlTransaction that spans across multiple table adapters that inherit from a base and classes so I need to set the connection and the transactions manually to all the commands. A transaction scope doesn't work as it requires something in Windows to be running that our environments don't have (really can't remember what it was).

Currently, I have to set all the commands in the table adapter base as I don't actually know which command is going to be called. With the stored procedure name, I can set just that command as some of the table adapters have like 50 queries and I am worried about the performance impact.

Upvotes: 0

Views: 67

Answers (0)

Related Questions