|
-
Feb 7th, 2007, 02:17 PM
#1
Thread Starter
Addicted Member
Need Help on txt Urgently
can anyone tell me what had went wrong ? my database not working thank you =)
VB Code:
Dim SQL2 As String
Dim strLine As String, strFullPath As String
Dim ff As Integer, iCount As Integer
Dim conn2 As ADODB.Connection
Set conn2 = New ADODB.Connection
Dim rs2 As ADODB.Recordset
Set rs2 = New ADODB.Recordset
conn2.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
"Server=localhost;" & _
"Port=3306;" & _
"Option=131072;" & _
"Stmt=;" & _
"Database=rach2;" & _
"Uid=eugene;" & _
"Pwd=rant;"
ff = FreeFile
x = 0
Open myfile For Input As #ff
txtHaha.Text = vbNullString
Do While Not EOF(ff)
Line Input #ff, strLine
strLine = "1310" + strLine
'inside my txt files will have numbers 131094567485 etc
SQL2 = "SELECT callerId, callDate, callTime FROM call_dc WHERE DATE_SUB(CURDATE(),INTERVAL 3 DAY) <= callDate AND callerId = " + strLine
rs2.CursorLocation = adUseClient
rs2.Open SQL2, conn2, adOpenForwardOnly, adLockReadOnly
Do While Not rs2.EOF
'if database number = txt number then it will list out in the text box where txtHaha is
If rs2.Fields("callerId") = strLine Then
txtHaha.Text = strLine
x = x + 1
End If
rs2.MoveNext
Loop
Loop
Close #ff
MsgBox x
MsgBox ("Section Complete Please Open Another File")
-
Feb 7th, 2007, 02:35 PM
#2
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"
-
Feb 7th, 2007, 02:46 PM
#3
Thread Starter
Addicted Member
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 ?
-
Feb 7th, 2007, 02:49 PM
#4
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.
-
Feb 7th, 2007, 02:53 PM
#5
Thread Starter
Addicted Member
Re: Need Help on txt Urgently
i tried nothings happening it wont go to the database i duno y
-
Feb 7th, 2007, 02:57 PM
#6
Thread Starter
Addicted Member
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 ?
-
Feb 7th, 2007, 03:02 PM
#7
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"
-
Feb 7th, 2007, 09:50 PM
#8
Thread Starter
Addicted Member
Re: Need Help on txt Urgently
i trieid but nothing happened
-
Feb 7th, 2007, 10:28 PM
#9
Thread Starter
Addicted Member
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
-
Feb 8th, 2007, 01:43 AM
#10
Re: Need Help on txt Urgently
It can't find a Field. Does this help (rearnging the syntax):
VB Code:
SQL2 = "SELECT callerId, callDate, callTime FROM call_dc WHERE [b]callDate >= DATE_SUB(CURDATE(),INTERVAL 3 DAY)[/b] AND callerId = " [b]&[/b] strLine
-
Feb 10th, 2007, 07:04 PM
#11
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|