Results 1 to 11 of 11

Thread: Need Help on txt Urgently

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Unhappy Need Help on txt Urgently

    can anyone tell me what had went wrong ? my database not working thank you =)


    VB Code:
    1. Dim SQL2 As String
    2.         Dim strLine As String, strFullPath As String
    3.     Dim ff As Integer, iCount As Integer
    4. Dim conn2 As ADODB.Connection
    5. Set conn2 = New ADODB.Connection
    6. Dim rs2 As ADODB.Recordset
    7. Set rs2 = New ADODB.Recordset
    8. conn2.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
    9.            "Server=localhost;" & _
    10.            "Port=3306;" & _
    11.            "Option=131072;" & _
    12.            "Stmt=;" & _
    13.            "Database=rach2;" & _
    14.            "Uid=eugene;" & _
    15.            "Pwd=rant;"
    16.  
    17.     ff = FreeFile
    18.     x = 0
    19.    
    20.         Open myfile For Input As #ff
    21.         txtHaha.Text = vbNullString
    22.         Do While Not EOF(ff)
    23.             Line Input #ff, strLine
    24.             strLine = "1310" + strLine
    25.             'inside my txt files will have numbers 131094567485 etc
    26.         SQL2 = "SELECT callerId, callDate, callTime FROM call_dc WHERE DATE_SUB(CURDATE(),INTERVAL 3 DAY) <= callDate AND callerId = " + strLine
    27.         rs2.CursorLocation = adUseClient
    28.         rs2.Open SQL2, conn2, adOpenForwardOnly, adLockReadOnly
    29.                 Do While Not rs2.EOF
    30.                      'if database number = txt number then it will list out in the text box where txtHaha is
    31.                     If rs2.Fields("callerId") = strLine Then
    32.                         txtHaha.Text = strLine
    33.                         x = x + 1
    34.                     End If
    35.                     rs2.MoveNext
    36.                 Loop
    37.         Loop
    38.     Close #ff
    39.     MsgBox x
    40.     MsgBox ("Section Complete Please Open Another File")

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Need Help on txt Urgently

    whats the error

    Oh and a side note.. do not use '+' to concat strings.. use &

    strLine = "1310" & strLine
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: Need Help on txt Urgently

    ic i have no errors but it just stuck on the first one and then it wont move next to the database. anyway what im trying to do is to do a compare with the database from my text file and if there is = 131094523433 then it will show it in the text field can you help me ?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Need Help on txt Urgently

    Put a break at the beginning and step through it to see if you can determine what is happening.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: Need Help on txt Urgently

    i tried nothings happening it wont go to the database i duno y

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: Need Help on txt Urgently

    no matter how i try or put a msgbox to state im here but it dosent go to the do while not rs2.eof it wont get in hmm did i misplace something ? or i left out some codes ?

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Need Help on txt Urgently

    1) make sure you replace + with & in this line

    SQL2 = "SELECT callerId, callDate, callTime FROM call_dc WHERE DATE_SUB(CURDATE(),INTERVAL 3 DAY) <= callDate AND callerId = " + strLine

    SQL2 = "SELECT callerId, callDate, callTime FROM call_dc WHERE DATE_SUB(CURDATE(),INTERVAL 3 DAY) <= callDate AND callerId = " & strLine

    next - right after that line
    put
    Debug.print strLine

    and see what it spits out in the debug window.
    check to make sure those values are in your DB
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: Need Help on txt Urgently

    i trieid but nothing happened

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: Need Help on txt Urgently

    now it has errors it says that the item cannot be found in the collection corrospond to the requested name or ordinal

  10. #10
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Need Help on txt Urgently

    It can't find a Field. Does this help (rearnging the syntax):
    VB Code:
    1. SQL2 = "SELECT callerId, callDate, callTime FROM call_dc WHERE [b]callDate >= DATE_SUB(CURDATE(),INTERVAL 3 DAY)[/b] AND callerId = " [b]&[/b] strLine

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: Need Help on txt Urgently

    erm the syntax is correct

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