Results 1 to 4 of 4

Thread: Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    26

    Angry Help

    What is wrong with this code i get a error everytime
    rivate Sub log_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles log.Click
    Dim strCommandText As String = "SELECT COUNT(*) as USRMATCH FROM USER WHERE " & _
    "USERNAME = '" & Me.user.Text & "' AND PASSWORD = '" & Me.pass.Text & "'"

    Dim sqlconn As New SqlConnection _
    ("data source = localhost; initial catalog=ICS; user ID=sa;password=xxx")
    sqlconn.Open()



    Dim iResult As Integer
    ' iResult = Convert.ToInt32(SqlConn)
    If iResult <> 0 Then
    SqlConn.Close()

    Else
    MsgBox("Invalid UserID or Password Please enter your UserName and Password")
    End If

  2. #2
    Lively Member TLord's Avatar
    Join Date
    Jun 2004
    Posts
    95
    Can you post more information about the exception please?
    Do you think my life is easy?
    Do you think it's good to win?
    do you think it's nice to kill?
    Do you think learning is a must?
    Do you think computers are nothing?
    Do you think this post is stupid?
    Do ypu think we're really humen?

    DO YOU THINK IT'S GOOD TO THINK AT ALL? ? ? ! ! !

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    26
    this is the error i get
    An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

    Additional information: System error.

    the code is


    Private Sub log_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles log.Click
    Dim strCommandText As String = "SELECT COUNT(*) as USRMATCH FROM USER WHERE " & _
    "USERNAME = '" & Me.user.Text & "' AND PASSWORD = '" & Me.pass.Text & "'"

    Dim sqlconn As New SqlConnection _
    ("data source = localhost; initial catalog=ICS; user ID=sa;password=xxx")
    sqlconn.Open()



    Dim iResult As Integer
    ' iResult = Convert.ToInt32(SqlConn)
    If iResult <> 0 Then
    SqlConn.Close()

    Else
    MsgBox("Invalid UserID or Password Please enter your UserName and Password")
    End If

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by cisco
    data source = localhost;
    Localhost? I doubt if that is correct. Has this worked in the past? Are you sure it's not (local) ?

Posting Permissions

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



Click Here to Expand Forum to Full Width