I have a routine when a user press the <Enter> button, it will take a picture and then call a routine to upload to the web server. However, i keep getting an error message saying 'file not found' when it tries to upload the picture. i have checked the path and it is right. What it looks like is, the camera taken process hasn't finished creating the picture when i try to upload it, i am not sure what i did wrong. Any help will be appreciated.
Sub BtnEnter_Click
Dim username, sqlstr, dateString As String
Dim confirmOK, Count As Int
in_out = 0
Count = SQLdb.ExecQuerySingleResult("SELECT count(*) FROM usertbl WHERE usercode = '" & codeEnter & "'")
If (Count <= 0) Then
Msgbox("Invalid User Code","Error")
lbl_cnt = 0
codeEnter = ""
Lbl1.Text = ""
Lbl2.Text = ""
Lbl3.Text = ""
Lbl4.Text = ""
Else
Cursor1 = SQLdb.ExecQuery("SELECT * From usertbl WHERE usercode = '" & codeEnter & "'")
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
username = Cursor1.GetString("name")
Next
Cursor1.Close
confirmOK = Msgbox2(username,"Please Confirm","Sign In","Cancel","Sign Out",Null)
If ((confirmOK = DialogResponse.POSITIVE) Or (confirmOK = DialogResponse.NEGATIVE)) Then
filename= "1.png"
camEx.TakePicture
sqlstr = "INSERT into clocktbl (clocktime, usercode, imagename,in_out,devID) VALUES ('" & curDate.Text & "','" & codeEnter & "','" & filename & "','" & in_out & "','" & deviceID & "')"
SQLdb.ExecNonQuery(sqlstr)
' call function to upload file to web server
file_upload(filename)
Sub BtnEnter_Click
Dim username, sqlstr, dateString As String
Dim confirmOK, Count As Int
in_out = 0
Count = SQLdb.ExecQuerySingleResult("SELECT count(*) FROM usertbl WHERE usercode = '" & codeEnter & "'")
If (Count <= 0) Then
Msgbox("Invalid User Code","Error")
lbl_cnt = 0
codeEnter = ""
Lbl1.Text = ""
Lbl2.Text = ""
Lbl3.Text = ""
Lbl4.Text = ""
Else
Cursor1 = SQLdb.ExecQuery("SELECT * From usertbl WHERE usercode = '" & codeEnter & "'")
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
username = Cursor1.GetString("name")
Next
Cursor1.Close
confirmOK = Msgbox2(username,"Please Confirm","Sign In","Cancel","Sign Out",Null)
If ((confirmOK = DialogResponse.POSITIVE) Or (confirmOK = DialogResponse.NEGATIVE)) Then
filename= "1.png"
camEx.TakePicture
sqlstr = "INSERT into clocktbl (clocktime, usercode, imagename,in_out,devID) VALUES ('" & curDate.Text & "','" & codeEnter & "','" & filename & "','" & in_out & "','" & deviceID & "')"
SQLdb.ExecNonQuery(sqlstr)
' call function to upload file to web server
file_upload(filename)