Problem with Identity field in Delphi 2, with ODBC SQL server 6.5 link 
Author Message
 Problem with Identity field in Delphi 2, with ODBC SQL server 6.5 link

I am getting an error when I attempt to add a record, with a table object,
to a SQL server database, via an ODBC link. I dont have SQL links. It seems
that it wants soemthing to filled into the identifier field, the only
problem is that if I do that SQL server returns an error that an illegal
attempt was made to insert a field (the identifier field) .

Except for trying a SQL query, is there any other option ?



Sat, 23 Oct 1999 03:00:00 GMT  
 Problem with Identity field in Delphi 2, with ODBC SQL server 6.5 link

When You do an "select * from animals" then you can use : Query.Open; But
when doing an
"insert into .............." then You have to use Query.ExecSQL;

Hope This helps

Felix



Quote:
> I am getting an error when I attempt to add a record, with a table
object,
> to a SQL server database, via an ODBC link. I dont have SQL links. It
seems
> that it wants soemthing to filled into the identifier field, the only
> problem is that if I do that SQL server returns an error that an illegal
> attempt was made to insert a field (the identifier field) .

> Except for trying a SQL query, is there any other option ?



Sun, 24 Oct 1999 03:00:00 GMT  
 Problem with Identity field in Delphi 2, with ODBC SQL server 6.5 link

Kallista has a Tech document that discusses issues with Delphi and MS
SQL 6.5. Goto thier web page (Kallista.com) under Tech and you should be
able to find a document called "Using Delphi with MicroSoft SQL Server
6.0" They mention issues with identity fields.

Steve Finner
OQS Software Design Inc.



Mon, 25 Oct 1999 03:00:00 GMT  
 Problem with Identity field in Delphi 2, with ODBC SQL server 6.5 link



Quote:
> I am getting an error when I attempt to add a record, with a table
object,
> to a SQL server database, via an ODBC link. I dont have SQL links. It
seems
> that it wants soemthing to filled into the identifier field, the only
> problem is that if I do that SQL server returns an error that an illegal
> attempt was made to insert a field (the identifier field) .

> Except for trying a SQL query, is there any other option ?

The "Required" property for this field is set by default. You can turn this
off either by creating field objects at design time (use the fields editor)
and turn "Required" for this field off, or during run time with this code:

        Table1.Fields[F].Required := False;
        F equals the field number.
or
        Table1.FieldByName('name of field').Required := False;



Thu, 28 Oct 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Problem with SQL 6.5 identity fields

2. MS SQL 6.5 and Identity fields

3. Delphi, 16bit Native SQL-Server 6.5 native/ ODBC drivers

4. Help: Identity recovering and Disconnections with Delphi 2 and SQL Server and ODBC

5. Delphi 2.0 and MS SQL Server 6.5 Problem

6. *** SQL Server 6.5 and Delphi 1 Problems ***

7. D2 SQL LINKS and MSSQL Server 6.5

8. Hang up when using D1 + ODBC + MS SQL Server 6.5

9. SQL Server 6.5: Native driver vs. ODBC

10. Getting @@Identity from SQL Server via ODBC Driver

11. ms-sql-server identity field with delphi3

12. Insert record w/SQL Server identity field

 

 
Powered by phpBB® Forum Software