My coding is simplified by using a single line of code to connect to MS-SQL 2008 R2 Databases. However I wish to have a msgbox displayed on login/password failure. Here's the coding.
My.Settings.Item("CustomerConnectionString") = "Data Source=.\SQLEXPRESS; Initial
Catalog=customer; uid = temp ; pwd = temp"
<< catch error required >>
Thanks.
First assign the value to app.config connection string:
Then use Try Catch Block. If connection fails use yor message box in catch block.
Declare globalConnStr as global variable and when you are done with the checking of the login credentials assign the connection string to globalConnStr. After this you can use the globalConnStr string as many times you want in your program.