Hi I’ve googled for this…it’s been 2 days…this null stuff really cracking my head! …please someone tell me is there anything wrong with my code ????
here it is :-
Public Sub checkemail()
sqlcheckemail = "select Email from WEBUSER where Email='" + TBEmail.Text + "'"
Dim dscheckemail As New DataSet
Dim sqlCnn As New SqlConnection
'Dim MYNULL As String
sqlCnn = New SqlConnection(connStr)
sqlCmd = New SqlCommand(sqlcheckemail, sqlCnn)
sqlCnn.Open()
da.SelectCommand = sqlCmd
da.Fill(dscheckemail)
'MYNULL = CheckDBNull(dscheckemail)
'If Not (dscheckemail.Tables.Count > 0) AndAlso (dscheckemail.Tables(0).Rows.Count > 0) Then
'If Not IsDBNull(dscheckemail) Then
'If Not (dscheckemail Is Nothing) Then
'If MYNULL = "NULL" Then
If Not dscheckemail Is Nothing Then
LabelGender.Text = "There is something"
'MsgBox("Unable to register because the E-mail address has already registered as a user, Please register using different Email address or contact administrator")
'Response.Redirect("~/Rnewuser.aspx")
Else
'MsgBox("u can register")
LabelGender.Text = "NULL"
End If
sqlCmd.Dispose()
sqlCnn.Close()
End Sub
if u see the one that i’ve commented is the one i already googled at tested…so now if the email address exist in the db..everything works wonderful..but if it doesn’t exist the code should process the one that does not satisfy the first if statement…but now i’m getting the result as “There is something” eventhough the email does not exist in the db….
PLEASE HELP ME!!!! I’ve done this null thingy before..but long time back and i didn’t save the codes..now i’m doing it back for my own website..n it’s cracking me
The dataset is not nothing thats why is entering the if, you should check the datatable inside.