SQL Server uniqueindentifier field

From: Bob Fleischman (bob.fleischman_at_automateddocsys.com)
Date: 06/21/04

  • Next message: Mark A. Deal: "ClientDataSet with SQL Server Triggers"
    Date: Mon, 21 Jun 2004 16:41:31 -0400
    
    

    We are trying to use a SQL database with a uniqueidentifier primary key via
    an ADODataset.

      dtmdlQueryObjects.tblSQLObject.Open;
      dtmdlQueryObjects.tblSQLObject.Insert;
      dtmdlQueryObjects.tblSQLObjectSQLObjectName.Value := 'zz_TryMe';
      dtmdlQueryObjects.tblSQLObjectSortOrder.Value := 1;
      dtmdlQueryObjects.tblSQLObject.Post;
      ShowMessage('After Key: ' +
    GUIDToString(TGuidField(dtmdlQueryObjects.tblSQLObject.FieldByName('SQLObjec
    t_ID')).AsGuid));

    The SQLObject_ID field always returns all Zeros.
    {00000000-0000-0000-0000-000000000000}

    We have tried many permutations of cursors and property settings with no
    luck.

    Has anyone got this to work??

    Thanks

    Bob Fleischman

    Here is sample DDL for the table

    CREATE TABLE [dbo].[SQLObjects] (
     [SQLObject_ID] uniqueidentifier ROWGUIDCOL NOT NULL ,
     [SQLObjectName] [varchar] (255) NULL ,
     [SortOrder] [int] NULL ,
    ) ON [PRIMARY]
    GO


  • Next message: Mark A. Deal: "ClientDataSet with SQL Server Triggers"