Error when making Windows EXE

Discussion in 'Questions (Windows Mobile)' started by mozaharul, Jan 13, 2009.

  1. mozaharul

    mozaharul Active Member Licensed User

    In a Sub program of my application used for backup, I initialized a local variable as hh_new_rec=0, then used it (in same Sub) in a loop ( count the inserted records. Then in a listbox, message is added to show the number of records inserted in the database.
    The application runs fine on the desktop (made for desktop), but when try to make Windows EXE it gives error message as attached. As I can understand, the message says variable of string type cannot be added using the operator +, but I did not declare the variable as string. Off course, there is a mistake on my part. Please correct me.

    Sub x
    --- ---
    --- ---
    hh_new_rec=0 ‘a local variables initialized
    --- ---
    --- ---
    For a= 0 to some_value
    cmd2.CommandText="select Backup_Date from "& k &" where Backup_Date='"&table2.Cell("Backup_Date",a)&"'" 'selecting form Device table of Master database
    If table3.RowCount=0 Then
    cmd2.CommandText="insert into "& k &" values('"&table2.Cell("device_id",a)&"','"&table2.Cell("Backup_Date",a)&"')"
    hh_new_rec=hh_new_rec+1 'counts the inserted row
    cmd2.CommandText="update device set device_ID='"&table2.Cell("device_id",a)&"'where backup_date='"&Date(Now)&"';"
    End If
    If hh_new_rec > 0 Then
    listbox1.Insert (i,&" "&hh_new_rec & " record(s) inserted in the " &K & " Table " & "at " & Time(Now))
    End If
    --- ---
    --- ---
    End sub

  2. klaus

    klaus Expert Licensed User

    In this line
    listbox1.Insert (i,[COLOR=red]&[/COLOR]" "&hh_new_rec & " record(s) inserted in the " &K & " Table " & "at " & Time(Now))
    the first & must be removed and the line looks like
    listbox1.Insert (i," "&hh_new_rec & " record(s) inserted in the " &K & " Table " & "at " & Time(Now))
    Best regards.
  3. mozaharul

    mozaharul Active Member Licensed User

    Hi klaus,

    Glad to hear from you. Thanks and best regards.
  4. Cableguy

    Cableguy Expert Licensed User

    This is puzzling me....:):sign0161:

    listbox1.Insert (i,&" "&hh_new_rec & " record(s) inserted in the " &K & " Table " & "at " & Time(Now))

    Why use the ampersand in a known contiguous string?

    Woulnd't this work as well?
    listbox1.Insert (i," "&hh_new_rec & " record(s) inserted in the " &K & " Table at " & Time(Now))
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice