Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get the SqlConnection from SqlDataAdapter?

Is there any way to get the SqlConnection from an SqlDataAdapter?

I had expected to find an SqlDataAdapter.Connection property.

like image 580
wizzardmr42 Avatar asked Dec 07 '25 09:12

wizzardmr42


2 Answers

Look at the SelectCommand or whichever command you're interested in.

like image 191
dotjoe Avatar answered Dec 08 '25 23:12

dotjoe


SqlDataAdapter has property SelectCommand (type of SqlCommand) and SelectCommand has property Connection (type of SqlConnection).

like image 39
kmatyaszek Avatar answered Dec 08 '25 21:12

kmatyaszek