q) re MS Data Access Block

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

It seems kind of inefficient to have to pass the connection string in each
time you use one of the SqlHelper methods. Does it make more sense to have
it stored at the SqlHelper class or at least have that class get it from
somewhere else as opposed to having to continually pass it from everyplace
it's used?

Thanks
bwolf at issgroup dot net
 
bill said:
It seems kind of inefficient to have to pass the connection string in each
time you use one of the SqlHelper methods. Does it make more sense to have
it stored at the SqlHelper class or at least have that class get it from
somewhere else as opposed to having to continually pass it from everyplace
it's used?

It's not inefficient, but it is a hastle. But you shouldn't really be
hitting the SQLHelper layer directly from application code anyway. You
should wrap the SQLHelper code in an application-specific data-access layer.
The DAL will store the connection string, manage connection lifetime and
handle all the interaction with SQLHelper. Then all your data access calls
are funneled first through your DAL, which in turn uses SQLHelper or
whatever.

David
 
Back
Top