Hi all,

How can I capture SQL Server Errors and validate sql server credentials?

I've got the following code on a Login button:

VB Code:
  1. Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
  2.         If (RdoSQLAuth.Checked = True) Then
  3.             JMSGlobals.JMSConnection.ConnectionString = "Server=" & Me.txtJMSServer.Text & ";Database=MSTRIBOLOGY;User ID=" & Me.txtUsername.Text & ";Password=" & Me.txtPassword.Text & ";Trusted_Connection=False;workstation id=" & Environment.MachineName & ""
  4.             Me.DialogResult = DialogResult.OK
  5.             'Me.Close()
  6.  
  7.         ElseIf (RdoNTAuth.Checked = True) Then
  8.             JMSGlobals.JMSConnection.ConnectionString = "Data Source=" & Me.txtJMSServer.Text & ";Initial Catalog=MSTRIBOLOGY;Integrated Security=SSPI;workstation id=" & Environment.MachineName & ""
  9.             Me.DialogResult = DialogResult.OK
  10.             'Me.Close()
  11.  
  12.         End If
  13.     End Sub

Any Help will be app...


Thanks Rudi