UserID's that are char

Results 1 to 2 of 2

Thread: UserID's that are char

  1. #1
    aspeer Guest

    Default UserID's that are char

    ON my login page, I have created events that check the database for matching username and password with those on the form. My SP, DBAuthenticate, returns integer values, incliding that userID depending on if it finds matches or not. My problem is that I have USer ID&#039;s that contain letters, so this obviously is not going to pass. How can i fix up my code so that instead of passing these integer values, i pass char values. right now, the error reads like this for my code:<BR><BR>Cast from type &#039;Integer&#039; to type &#039;Char&#039; is not valid. <BR><BR>Heres the code:<BR><BR>Sub button_Click (s As Object, e as EventArgs) <BR>If IsValid Then <BR>Dim IntUserID as char<BR>IntUserID = DBAuthenticate(txtusername.text, txtPassword.text) <BR>Select Case IntUserID <BR>Case "none" <BR>LblMessage.text = "Non existent user" <BR>Case "wrong"<BR>LblMessage.text = "Invalid Password" <BR>Case Else <BR>Session("Regionid") = IntUserID <BR>Session("RegionName") = TxtUsername.text <BR>response.redirect(return_page)<BR>End Select <BR>end If <BR>End Sub <BR><BR>Function DBAuthenticate (strUsername As String, strPassword As String)<BR>Dim conMyData As SqlConnection <BR>Dim cmdSelect As SqlCommand <BR>Dim ParmReturnValue As SqlParameter <BR>Dim intResult as char <BR><BR>conMyData = New SqlConnection("Server=localhost;UID=User;PWD=pw;Da tabase=db") <BR>cmdSelect = New SqlCommand ("DbAuthenticate", conMyData) <BR>cmdSelect.CommandType = CommandType.StoredProcedure <BR>parmReturnValue = cmdSelect.Parameters.Add( "return_value", SqlDBType.Char) <BR>parmReturnValue.Direction = ParameterDirection.ReturnValue <BR>cmdSelect.Parameters.add("@Username", strUserName) <BR>cmdSelect.Parameters.add("@password", strpassword) <BR>conMyData.Open() <BR>cmdSelect.ExecuteNonQuery() <BR>conMyData.Close() <BR>intResult = cmdSelect.Parameters("return_value" ).value <BR>Return IntResult <BR>End Function <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Cusoxty = Troll, ignore


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts