How to control duplicates

Discussion in 'Questions (Windows Mobile)' started by jchal, Oct 5, 2008.

  1. jchal

    jchal Active Member Licensed User

    i have a tale and i have allow to take duplicates but then i want to collect them i am writing a bar code scanner software
    every time tyhe scaner scans the same item i put 1 for quantity but but if i scan 5 items the quantity must be 5
    can anybody help?
     
  2. Ricky D

    Ricky D Well-Known Member Licensed User

    try this

    Are you using an SQLite database to store them? Or are you just putting them into the table?

    In SQL you'd use
    cmd is a Command object, reader is a DataReader object

    If IsNull(reader.Value)=false Then reader.close
    sqlText="Select Count(BarCode) as BarCodeCount Where BarCode=yourbarcodevalue"
    cmd.CommandText=sqlText
    reader.Value=cmd.ExecuteReader
    reader.ReadNextRow

    the result comes back in reader.GetValue(0)

    The 1st line makes sure the reader is closed. If it isn't closed you get a runtime error when you try to use the command object.

    I hope this helps.

    If you're doing it from the table then set a filter and get the rowcount

    Table1.Filter("BarCode='" & yourbarcode & "'")
    Msgbox(Table1.RowCount)
    Table1.Filter("") clears the filter


    regards, Ricky
     
Loading...
  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