[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can I identify a kind of field from my access table?

Posted on 2007-03-30
2
Medium Priority
?
175 Views
Last Modified: 2013-11-23
Hello Guys,

I have a system to update access database, I make a backup from my rows in a file and after updating the
access dabase I restore my rows. Some tables I have a autonumber  field, I don't use them, but I have a problem with my procedure because it tries to recored the number in this field. How could I identify if my field is a autonumber field, so I could skip this field in my while. Take a look at my code:
    Qry.Close;
    Qry.Sql.Clear;
    Qry.Sql.Add('SELECT * FROM ' + Tabela);
    Qry.Open;
    Qrestore.LoadFromFile(MyFile);

     While Not Qrestore.Eof do
      Begin
          Qry.Append;
          For I := 0 to Pred(Qrestore.FieldCount) do
          Begin
            Qry.FieldByName(Qrestore.Fields.Fields[I].FieldName).AsString := Qrestore.Fields.Fields[I].AsString
          End;
          Qry.Post;
          Application.ProcessMessages;
          Gauge1.Progress := Gauge1.Progress + 1;
          Qrestore.Next;
        End;
0
Comment
Question by:hidrau
2 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 2000 total points
ID: 18826743
Try this

if not (Qry.FieldByName(Qrestore.Fields.Fields[I].FieldName) is TAutoIncField) then
      Qry.FieldByName(Qrestore.Fields.Fields[I].FieldName).AsString := Qrestore.Fields.Fields[I].AsString
0
 
LVL 1

Author Comment

by:hidrau
ID: 18827313
thanks very much
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month20 days, 6 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question