Re: Please help with a serious issue



here is an example of my code:

DataModule4.tblLineItems.Active := true;
  DataModule4.tblLineItems.Filter := 'OrderNo = ' + 
QuotedStr(lblOrderNum.Caption);
  DataModule4.tblLineItems.Filtered := true;
for ii := 0 to ListView1.Items.Count - 1 do begin
    DataModule4.tblLineItems.Append;
    DataModule4.tblLineItems.FieldByName('OrderNo').AsInteger := 
StrToInt(lblOrderNum.Caption);
    DataModule4.tblLineItems.FieldByName('ProductID').AsString := 
ListView1.Items[ii].SubItems[10];
    DataModule4.tblProducts.Filter := 'PRODUCTT = ' + 
QuotedStr(ListView1.Items[ii].SubItems[10]);
    DataModule4.tblProducts.Filtered := true;
    SalesCat := DataModule4.tblProducts.Fields[76].AsString;
    DataModule4.tblLineItems.FieldByName('SalesCat').AsString := SalesCat;

    DataModule4.tblLineItems.FieldByName('Quantity').AsString := 
ListView1.Items[ii].Caption;
    DataModule4.tblLineItems.FieldByName('UnitPrice').AsString := 
ListView1.Items[ii].SubItems[7];
    DataModule4.tblLineItems.FieldByName('Cost').AsString := 
ListView1.Items[ii].SubItems[8];
    DataModule4.tblLineItems.FieldByName('QBDescriptionID').AsString := 
ListView1.Items[ii].SubItems[9];
    DataModule4.tblLineItems.FieldByName('OverRide').AsString := 
ListView1.Items[ii].SubItems[11];
    DataModule4.tblLineItems.FieldByName('Comments').AsString := 
ListView1.Items[ii].SubItems[12];
    DataModule4.tblLineItems.FieldByName('Desc').AsString := 
ListView1.Items[ii].SubItems[0];
    if ListView1.Items[ii].SubItems[6] <> ' ' then begin
      DataModule4.tblLineItems.FieldByName('ProdInfo').AsString := 
ListView1.Items[ii].SubItems[6];
    end else begin
      DataModule4.tblLineItems.FieldByName('ProdInfo').AsString := ' ';
    end;

    DataModule4.tblInvoices.Active := true;
    DataModule4.tblInvoices.Sort := 'InvoiceNo ASC';
    DataModule4.tblInvoices.Last;
    DataModule4.tblInvoices.active := false;
    DataModule4.tblLineItems.FieldByName('Status').AsString := 'NEW';
    DataModule4.tblLineItems.FieldByName('LastEditDate').AsDateTime := Date;
    DataModule4.tblLineItems.FieldByName('LastEditedBy').AsString := 
strLocalUser;
    dblLineWT := copy(ListView1.Items[ii].SubItems[1], 1, pos(' ', 
ListView1.Items[ii].SubItems[1]) - 1);
    strLineUnit := copy(ListView1.Items[ii].SubItems[1], pos(' ', 
ListView1.Items[ii].SubItems[1]) + 1, 
length(ListView1.Items[ii].SubItems[1]));
    DataModule4.tblLineItems.FieldByName('Weight').AsString := dblLineWT;
    DataModule4.tblLineItems.FieldByName('WeightOrdered').AsString := 
dblLineWT;
    DataModule4.tblLineItems.FieldByName('WTUnit').AsString := strLineUnit;
    DataModule4.tblLineItems.FieldByName('Length').AsString := 
ListView1.Items[ii].SubItems[4];
    DataModule4.tblLineItems.FieldByName('Width').AsString := 
ListView1.Items[ii].SubItems[3];
    DataModule4.tblLineItems.FieldByName('Thickness').AsString := 
ListView1.Items[ii].SubItems[2];
    DataModule4.tblLineItems.FieldByName('Lookup').AsString := 
ListView1.Items[ii].SubItems[5];
    DataModule4.tblLineItems.FieldByName('WTFullVal').AsString := 
ListView1.Items[ii].SubItems[14];
    DataModule4.tblLineItems.FieldByName('LENFullVall').AsString := 
ListView1.Items[ii].SubItems[15];
    DataModule4.tblLineItems.FieldByName('LookupVal').AsString := 
ListView1.Items[ii].SubItems[13];
    DataModule4.tblLineItems.FieldByName('GoldReport').AsString := GLDRPT;
    DataModule4.tblLineItems.FieldByName('TRANSTYPE').AsInteger := 1;
  end;
  // commit the line items
  DataModule4.tblLineItems.Post;

This code is similarly used for all areas of the software, including 
displaying the customer info, by filtereing the table to the id user types 
in.

Can you see anything inherintly wrong i am doing here?
Thanks,
David L. Bracken

"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message 
news:3pb0u1ld4ohf9cicemnu7h1npnf99lc6t0@xxxxxxxxxx
>
> Are you using explicit transactions in your that are open while the user 
> edits
> data?  If you are that is your problem.
> Otherwise if your users are not trying to edit the same record I don't see 
> a
> reason for multiple users to create a problem that corresponds with the 
> error
> message you are getting.
>
> My guess is that it has something to do with you application posting a 
> record
> and then going back and re-editing that record with out requerying the 
> data.
> The default for ADO to generate update code is to use all of the original 
> values
> from fields in a record to locate the record in the database to be 
> updated.
> After an update if the value in the database doesn't exactly match the 
> value in
> the updated record on the clientside cursor a subsequent update will fail.
> DateTime fields are prone to this problem if they contain miliseconds.
> You can try switching updates to just use the key field value for 
> updating.
>
> to set update to only use key fields use
> ADODataSet1.Properties['Update Criteria'].value :=adCriteriaKey;
>
> Your choices are adCriteriaKey, adCriteriaAllCols (BDE's default),
> adCriteriaUpdCols (ADO's default) and adCriteriaTimeStamp. Search the
> Platform SDK for more details.
>
> http://support.microsoft.com/default.aspx?scid=kb;EN-GB;q190727&GSSNB=1
>
>
>
>
>>It is random, and i dont know for sure. There are primary keys in all my
>>tables. The problem seems to be that access doesnt handle multiple users
>>hitting the same spots on the db at the same time very well. I was using
>>filters to filter the table to the need record, but then the next person 
>>to
>>come along gets the wrong data because of the filter applied for the first
>>user.
>>
>>Here is the scenario, and i dont know how to set this up properly , so any
>>help you can give would be greatly appreciated.
>>
>>There are at any given time 3 users using my software to take orders for
>>customers, or invoice the completed orders, etc.
>>User 1 selects customer 1. The credit card table is filtered to that 
>>account
>>so that the invoice which points at the cctable has the correct data. Now
>>user 1 does not commit this invoice.(has to walk away from computer or
>>something).
>>User 2 selects customer 2, and credit card table is again filtered, and 
>>when
>>user1 comes back the cc data is now wrong.
>>
>>What i basically need to know is how to allow multiple users to use the 
>>same
>>server db for all the clients. i do not want to have to have them do
>>everything locally and then write some serious code for updating the 
>>server
>>with thier local stuff. I have the Adoconnection and all my tables
>>cursorlocation set to client side and cursor type to static.(i tried 
>>dynamic
>>as well, but no change). How do i allow writing and retrieveing of data
>>across multiple clients without them tripping over each others data?
>>I am seriously pulling my hair out here, i am a novice at db programming,
>>but i did not think this would be so difficult. things that keep happening
>>like, credit card data is shown correctly in the software but when the
>>invoice is printed it is the wrong credit card number.
>>The main tables of this software is:
>>Products table - holds all products, prices etc.
>>Customer table - Customers info including address contact etc.
>>Customer Shipping - Holds all possible shipping addresses for each client.
>>They can have multiple
>>Credit Card table - Holds credit card data for customers, these may also
>>contain multiple for each customer
>>Orders table - holds the information for the order
>>Lineitems table - holds info for each line item related by order number
>>Invoice table - invoice info which relates to order table and lineitem 
>>table
>>
>>at one point or another, every one of these tables is used to get through 
>>a
>>single order, and there are 3 users doing this simultaneously.
>>
>>If we decided to switch db's would the free SQL server version be
>>sufficient, and would it automatically solve my issues?
>>
>>sorry for all the noob questions.
>>Thanks in advance,
>>David L. Bracken
>>
>>"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message
>>news:4mltt19p88jj9lrq9k2d0dad1a3b602l91@xxxxxxxxxx
>>>
>>>>I have written an order entry/inventory/reporting app.
>>>>I am using an ADOConnection component with many ADOTables. The software 
>>>>is
>>>>run from the client machines and connects to an Access db on the server.
>>>>I keep getting "row cannot be located" message, but i am not using any
>>>>triggers that i am aware of. I only use one ADOQuery component to empty 
>>>>a
>>>>temp table.
>>> Are you getting this message every time you try to update a record or 
>>> only
>>> some
>>> of the time?
>>> Does it just happen after you have inserted a new record and then go 
>>> back
>>> to it
>>> and change it?
>>> Do you have primary keys on your tables?
>>> --
>>> Brian Bushay (TeamB)
>>> Bbushay@xxxxxxxxx
>>
>
> --
> Brian Bushay (TeamB)
> Bbushay@xxxxxxxxx 


.



Relevant Pages

  • Re: Please help with a serious issue
    ... The problem seems to be that access doesnt handle multiple users ... >User 1 selects customer 1. ... The credit card table is filtered to that account ... >Customer Shipping - Holds all possible shipping addresses for each client. ...
    (borland.public.delphi.database.ado)
  • Re: Please help with a serious issue
    ... User 1 selects customer 1. ... The credit card table is filtered to that account ... What i basically need to know is how to allow multiple users to use the same ... Customer Shipping - Holds all possible shipping addresses for each client. ...
    (borland.public.delphi.database.ado)
  • Re: Please help with a serious issue
    ... but then another user also applies a different filter. ... >>User 1 selects customer 1. ... The credit card table is filtered to that ... >>Customer Shipping - Holds all possible shipping addresses for each client. ...
    (borland.public.delphi.database.ado)
  • Re: Table bloat in Linq-SQL
    ... they are created on client site. ... customers with extended properties using Linq-SQL: ... Those scripts are compiled in customer site and can use extended properties. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Odd situation, advice needed on penentration test results
    ... >>I think the reason for the original post is because ... > gone to the client and said something. ... > do is to inform the customer. ... >>intrusion that needs to be analyzed and reported so ...
    (Pen-Test)