Revision: 16023
Updated Code
at October 28, 2009 14:21 by fuzzylogic
Updated Code
Function CheckExistingUsername(ByVal username As String) As Boolean Dim UserExists As Boolean = False Dim strConn As String = System.Configuration.ConfigurationManager.ConnectionStrings("Fullconnection").ConnectionString Dim MySQL As String = "Select username from tUser where Username=@Username" Dim MyConn As New SqlConnection(strConn) Dim objDR As SqlDataReader Dim Cmd As New SqlCommand(MySQL, MyConn) Cmd.Parameters.Add(New SqlParameter("@Username", username)) Try MyConn.Open() objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection) While objDR.Read() UserExists = True End While Catch ex As Exception LogError("GlobalClass.vb :: CheckExistingUsername", ex.ToString) Finally MyConn.Close() CheckExistingUsername = UserExists End Try End Function
Revision: 16022
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 23, 2009 10:58 by fuzzylogic
Initial Code
Function CheckExistingUsername(ByVal username As String) As Boolean Dim UserExists As Boolean = False Dim strConn As String = System.Configuration.ConfigurationManager.ConnectionStrings("Fullconnection").ConnectionString Dim MySQL As String = "Select username from tUser where Username=@Username" Dim MyConn As New SqlConnection(strConn) Dim objDR As SqlDataReader Dim Cmd As New SqlCommand(MySQL, MyConn) Cmd.Parameters.Add(New SqlParameter("@Username", username)) Try MyConn.Open() objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection) While objDR.Read() UserExists = True End While Catch ex As Exception LBL_Info.Visible = True LBL_Info.Text = "Error: " & ex.Message Finally CheckExistingUsername = UserExists End Try End Function
Initial URL
Initial Description
Initial Title
Check if username is in use
Initial Tags
validation
Initial Language
VB.NET