TTable.Append problem.
- From: "Karl A. Sørensen" <kas@xxxxxxxxxxxxxxx>
- Date: Thu, 24 Jan 2008 14:17:26 +0100
Our program needs to be able to run against 2 different databases,
Pervasive.SQL and MSSQL server. We have earlier used Titan to connect to
Pervasive.SQL. Titan have a class TTbTable that's Titan's "TTable" class. To
minimize the rewrite of the application, I would like to use TTable to
connect to our database on a Pervasive.SQL server og MSSQL server. This
would minimize the need to change our code. Our database can be located on a
Pervasive.SQL server, or a MSSQL server.
I almost have a working test program, the only difficulty is creating new
records in MSSQL server using TTable.Append.
I do this:
myTTable.Append;
myTTable.FieldByName('Name'):='Name';
myTTable.Post;
There are other fields in my table, but I don't want to fill them all. This
gives me an exception, telling me that I have to fill all the fields (one by
one).
I then tried this:
For i:=0 to myTTable.FieldDefs.Count-1 do
begin
myTTable.FieldDefs[i].Required := false;
End;
myTTable.Append;
myTTable.FieldByName('Name'):='Name';
myTTable.Post;
But I still get the same exception (EDatabaseError: Field "RECNUM" must have
a value). Our RECNUM field is a "Identity integer column" in our SQL server
database, and so, we should not need to fill in a value for this
column/field. If I fill out the RECNUM field, I get another exception, that
basically tells me that I should not place anything in this field.
The above code works fine against the Pervasive.SQL database. I can locate,
edit and delete records in our MSSQL database, but not insert new records.
TIA
Karl
.
- Follow-Ups:
- Re: TTable.Append problem.
- From: Troll
- Re: TTable.Append problem.
- Prev by Date: Re: Binary file byte ordering
- Next by Date: Embed image in email
- Previous by thread: Re: pipe > redirection bug in Windows XP x64 Pro !!!!!?????!!!!!! 1> output.txt ?????
- Next by thread: Re: TTable.Append problem.
- Index(es):
Relevant Pages
|