Row ID, Sequence, PK, null,

Row ID, Sequence, PK, null,

Postby jkanerva » Wed 11 Feb 2009 03:29

I try to program a simple table editor inserting data into table with VC 2008 C#.

Table has a primary key RID (row id, like OID) to identify the row. Devart DataTable is connected to data grid of VC2008.
I just want to insert fields into table except RID but I can not.
The RID should return from DB as a refresh after insert because DB generates RID automatically IF RID is null during insert/update and default value comes from sequence. This RID is needed because the other fields can be anything, like empty (null) .

I have no way to insert data into table . If ROW field is null, there is a exception. PK field can not be null in devart SW.
I tried to use RID as a normal field, not as PK, but no help.
I tried to use read only, default value -1 in devart SW and all variations...
I tried to change the insert SQL but I did not get it running.

How can anybody insert a record into DB and get sequence row ID with devart SW ?
(I don't want to use postgres OID because it is not safe. )

Sequence is here :
CREATE SEQUENCE flexmat_rid
INCREMENT 1
MINVALUE 1
MAXVALUE 2147483647
START 10000
CACHE 1
CYCLE;
ALTER TABLE flexmat_rid OWNER TO flx_admin;

RID integer has default value nextval('flexmat_rid'::regclass).
RID is primary key of this table.

I noticed Devart SW has a own incrementing system (for OID or RID ) but then the sequence current number is not in the DB for back ups.

Is anyone using this postgres version for real commercial projects ?

************************************

Devart sample programs do not operate on VC 2008.
Don't help much. :roll:

************************************

The document (help) is very limited. It indicate mostly syntax, not descriptions. I miss samples.

***********************************

It seems that when the "Live data" is set True and the DB connection is disconnected or server is down the devart SW craches at start up.
I happened repeatedly for me.
***********************************
jkanerva
 
Posts: 11
Joined: Wed 11 Feb 2009 02:14

Postby Shalex » Wed 11 Feb 2009 12:43

1. I've just checked the 4.0.20 version of dotConnect for PostgreSQL. It works normally. Please follow these steps when using PgSqlDataTable (for design time):
a) in the Command Generator tab of PgSqlDataTable Editor, check all the options from the Options section (including both With refresh SQL and Quote names);
b) click the Get Table Fields button, for the RID column check the Key and Refreshing options and uncheck the Updating option; click the Generate Commands button; after the commands were generated, click OK;
c) set the Active property of the PgSqlDataTable object to true;
d) go to the Properties window of your PgSqlDataTable object, click the "..." button near the Columns property. Set the DefaultValue property for the RID column to 1;
e) click Preview Data from the PgSqlDataTable object context menu and check its workability.
Please notify us about the results.

2. Our samples were created for Visual Studio 2005 but you can open our sample solution in Visual Studio 2008, go through the Conversion Wizard, and get the project for Visual Studio 2008.

3. Devart documentation covers sufficiently only those aspects of using our components that are different from the behaviour of the standard Microsoft components. So, if you need comprehensive description of a certain topic, please refer to MSDN.

4. What is SW?
What does "the devart SW craches at start up" mean?
When I set the Active property of the PgSqlDataTable object to true, stopped the PostgreSql service and tried to click Preview Data, I got this appropriate message: "No connection could be made because the target machine actively refused it 127.0.0.1:5432". There are no other error messages or Visual Studio crash.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL