Hi experts,

I am trying to figure out code working for an auto testing as follows:
(in C# code, SQL database used)

1. Check whether database (having credentials) is working fine or down?
2. If working, run a select query in it & check for succesful execution.
3. In any case of failure for above 2 points, automatically send an email to somemone.

Kindly help me out. I think it would be a piece of cake for the experts here.

Thanks a ton

1) just open basic connection (search for sqlconnection) - place a try catch, and send email upon catch - this means db is down
2) search for sqlcommand - if 1) is successful, then do this
3) check this resource [snipped]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.