Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    23

    Unanswered: Getting different vale from databae using VB Select Query

    I am facing a weird problem. I am using the following select query unsing VB6.

    strquery = "SELECT * from item_lne where order_no = " + CStr(orderNum) + " AND (delete_lne = 'F' or delete_lne is null)"
    Set localrecordset = AGFDB.CONAGF.Execute(strquery)

    If localrecordset.RecordCount > 0 Then

    ....

    end if

    database engine used is db2k. ODBC is being used for database connectivity, and OS is Windows XP.

    when I run "strquery" on db2k command windows it shows me correct result for 8 records, but in program it returns "localrecordset.RecordCount " as 40.

    The same software connected to same database is working well, and it is giving me this error only when I am trying to install it on some other computers (same software connected to same database)

    Can anyone suggest me if this error has something to do with system "dll" files or BDE or runtime engine or what..? I am clueless.

    or please suggest me some resources where I can get some help.

    Regards,

    Anurag

  2. #2
    Join Date
    Jan 2004
    Posts
    184

    Re: Getting different vale from databae using VB Select Query

    It shouldn't be a problem with the dlls, if you are connecting to the same source and using the EXACT same query you should get the same results.

    Maybe the error is due to the datatype of order_no ?

    If Order_No is a string then your query should be (I added single quotes):

    ...where order_no ='" + CStr(orderNum) + "' AND...

    If Order_No is an Integer

    ...where CONVERT(INT,order_no) ='" + CStr(orderNum) + "' AND...

    Try that and let me know if it solves the problem.
    In abundance of water only the fool is thirsty. Bob Marley.

  3. #3
    Join Date
    Feb 2004
    Posts
    7

    Re: Getting different vale from databae using VB Select Query

    Try to change the syntax to '" & CStr(OrderNum) & "' AND .......... instead



    Originally posted by anuindia
    I am facing a weird problem. I am using the following select query unsing VB6.

    strquery = "SELECT * from item_lne where order_no = " + CStr(orderNum) + " AND (delete_lne = 'F' or delete_lne is null)"
    Set localrecordset = AGFDB.CONAGF.Execute(strquery)

    If localrecordset.RecordCount > 0 Then

    ....

    end if

    database engine used is db2k. ODBC is being used for database connectivity, and OS is Windows XP.

    when I run "strquery" on db2k command windows it shows me correct result for 8 records, but in program it returns "localrecordset.RecordCount " as 40.

    The same software connected to same database is working well, and it is giving me this error only when I am trying to install it on some other computers (same software connected to same database)

    Can anyone suggest me if this error has something to do with system "dll" files or BDE or runtime engine or what..? I am clueless.

    or please suggest me some resources where I can get some help.

    Regards,

    Anurag

Posting Permissions

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