Re: [SQL] Bouncing replies

2008-02-11 Thread Dave Page
On Feb 11, 2008 5:06 AM, Dean Gibson (DB Administrator)
<[EMAIL PROTECTED]> wrote:
> If mail to my list address doesn't come from one of your list
> servers (and those seems to change much more often than any other list I
> belong to), it gets rejected.

Those must be some *really* long-lived lists. Our mailserver has been
mail.postgresql.org for probably 7 or 8 years now. Many moons ago we
did use some additional relay servers, but I don't think we've done
that for 5+ years.

> I'm curious as to why the list server defaults to using a sender's
> address as the "Reply-to" address, rather than using the list address.
> That means that, unless the user is careful to "reply all" (or even
> better, just reply to the list address), any discussion immediately goes
> private.

Because thats the convention on these lists that people are used to
and prefer in general.

-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
The Oracle-compatible database company

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] Usage of UUID with 8.3 (Windows)

2008-02-11 Thread Tom Lane
[EMAIL PROTECTED] writes:
> Now, what do I have to do in order to generate a valid UUID (or the 5 
> different versions as implemented by the RFC) under Windows?

Figure out how to build ossp-uuid on Windows ...

regards, tom lane

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Gregory Stark
"Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> writes:

> Thanks for the reply Grogory. I am trying to do a INSERT INTO.
>
> Here is my table. n_gen, n_sheet, tot_n_sheet are defined as Primary Key
> (Serial not null)
>   id | n_gen | n_sheet   | tot_n_sheet
> --+---+---+-
> a|  1| 1 |  1
> b|  2| 1 |  2
> x|  2| 2 |  2
> u|  3| 1 |  1
> r|  4| 1 |  3
> a|  4| 2 |  3
> s|  4| 3 |  3
>
>
> So there are 2 users inserting in to the db. In my ASP page i have a field 
> that
> shows the value of n_gen +1. So when the 2 users both login at the same time,
> with different sessions, they both see "7" in the n_gen field. But when they
> click on the sumbit button only one record is inserted and the other is lost.
>
> I though it was possible to change the SQL string before it does the update..
> But i can't seem to find a solution for it.. Any idea ??

You'll have to explain what you want n_gen to contain.

Then you'll have to decide whether you want to do this in ASP where you can
certainly change the SQL all you like, or on the server where you can have
triggers which change the values being stored or executing additional queries.

-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com
  Ask me about EnterpriseDB's PostGIS support!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Shavonne Marietta Wijesinghe

Thanks for the reply Grogory. I am trying to do a INSERT INTO.

Here is my table. n_gen, n_sheet, tot_n_sheet are defined as Primary Key 
(Serial not null)

  id | n_gen | n_sheet   | tot_n_sheet
--+---+---+-
a|  1| 1 |  1
b|  2| 1 |  2
x|  2| 2 |  2
u|  3| 1 |  1
r|  4| 1 |  3
a|  4| 2 |  3
s|  4| 3 |  3


So there are 2 users inserting in to the db. In my ASP page i have a field 
that shows the value of n_gen +1. So when the 2 users both login at the same 
time, with different sessions, they both see "7" in the n_gen field. But 
when they click on the sumbit button only one record is inserted and the 
other is lost.


I though it was possible to change the SQL string before it does the 
update.. But i can't seem to find a solution for it.. Any idea ??


Thanks,

Shavonne

- Original Message - 
From: "Gregory Stark" <[EMAIL PROTECTED]>

To: "Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, February 11, 2008 5:03 PM
Subject: Re: Check before INSERT INTO



"Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> writes:

The user updates the DB via ASP. When 2 users click on the submit button 
at the
same time, only 1 record is inserted. (ERROR: duplicate key violates 
unique

constraint "my_shevi_pkey")

For example they both send a string like below.
strSQL = INSERT INTO my_shevi VALUES ('a', 4, 1, 1);

I thought of adding a test before executing the insert into.


It's not clear to me what you're trying to do. If you're trying to update 
an
existing record then you might want something like example 37-1 on this 
page:


http://www.postgresql.org/docs/8.2/interactive/plpgsql-control-structures.html

If you want to pick the first available n_gen then you're going to have to
repeatedly try inserting until you don't get that error. That will perform
quite poorly when you get to large values. You could do a "SELECT 
max(n_gen)
WHERE..." first but even that will be quite a lot of work for your 
database.


Perhaps you should rethink n_gen and use a serial column to generate your
primary key instead.


Set SQLN_GEN = oConn.Execute("SELECT upper(N_GEN), upper(N_SHEET),
upper(TOT_N_SHEET) FROM " & TableName & " WHERE N_GEN='" & n_gen & "' AND
N_SHEET='" & n_sheet & "' AND TOT_N_SHEET='" & tot_n_sheet & "'")


For what it's worth your script is a security hole. Look into using query
parameters which in ASP will probably be represented by "?". The method 
above
will allow hackers to get direct access to your database and do nasty 
things.


--
 Gregory Stark
 EnterpriseDB  http://www.enterprisedb.com
 Ask me about EnterpriseDB's RemoteDBA services! 



---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate


[SQL] PostgreSQL does not support updateable cursors

2008-02-11 Thread Premsun Choltanwanich


Dear All,
 
 I got error message 'ERROR: column "ctid" does not exist; Error while executing the query'  when I try to query SELECT on my VIEW as 'rsSystem.Open "SELECT * FROM v_memocatlist ORDER BY memocategory", connSystem, adOpenStatic, adLockOptimistic'. 
 
 I found some information on internet about the PostgreSQL does not support updateable cursors so I change my code to be read only cursors as  'rsSystem.Open "SELECT * FROM v_memocatlist ORDER BY memocategory", connSystem, adOpenForwardOnly, adLockReadOnly' then it work fine. However, I need to use this query for make data ready to be updated on some record. 
 
 How can I fix this problem?
 
More Information about my system.
Database: PostgreSQL 8.3ODBC: psqlODBC 08.03.0100Language: MS Visual Basic 6.0
 
Regards,
Premsun


  NETsolutions Asia 
  Limited 


  +66 (2) 237 7247 



  

  


Re: [SQL] Usage of UUID with 8.3 (Windows)

2008-02-11 Thread Alvaro Herrera
Tom Lane wrote:
> [EMAIL PROTECTED] writes:
> > Now, what do I have to do in order to generate a valid UUID (or the 5 
> > different versions as implemented by the RFC) under Windows?
> 
> Figure out how to build ossp-uuid on Windows ...

I think Windows has its own UUID generator, so the best bet would be to
make that work.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Shavonne Marietta Wijesinghe
ehmm and where is it said that N_GEN should add 1 before inserting the record?? 
sorry i don't understand the help.

Shavonne
  - Original Message - 
  From: Kopljan Michael 
  To: 'Shavonne Marietta Wijesinghe' 
  Sent: Monday, February 11, 2008 1:45 PM
  Subject: RE: [SQL] Check before INSERT INTO


  Try fierst to add Transaction issolation level to Connection object :

  Conn.IsolationLevel   = 1048576  && adXactIsolated

   

  Then when user submit form try something like this :

  strSQL = 'SELECT * FROM my_shevi ORDER BY n_gen DESC, n_sheet DESC, tot_sheet 
DESC LIMIT 1'

  Set SQLN_GEN = oConn.Execute(strSQL) 

  SQLN_GEN.AddNew

  SQLN_GEN('id').Value = 'a'

  Conn.BeginTrans()

  SQLN_GEN.Update

  SQLN_GEN.Requery()

  Conn.CommitTrans()

   

  Bye Michael

   


--

  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shavonne 
Marietta Wijesinghe
  Sent: Monday, February 11, 2008 1:04 PM
  To: pgsql-sql@postgresql.org
  Subject: [SQL] Check before INSERT INTO

   

  My table structure

   

  CREATE TABLE my_shevi 
  (
id text,
n_gen serial NOT NULL,
n_sheet serial NOT NULL,
tot_sheet serial NOT NULL,
CONSTRAINT my_shevi_pkey PRIMARY KEY (n_gen, n_sheet, tot_sheet)
  ) 
  WITH OIDS;
  ALTER TABLE my_shevi OWNER TO postgres;

   

  The user updates the DB via ASP. When 2 users click on the submit button at 
the same time, only 1 record is inserted. (ERROR:  duplicate key violates 
unique constraint "my_shevi_pkey")

   

  For example they both send a string like below.

  strSQL = INSERT INTO my_shevi VALUES ('a', 4, 1, 1);

   

  I thought of adding a test before executing the insert into. 

   

  Set SQLN_GEN = oConn.Execute("SELECT upper(N_GEN), upper(N_SHEET), 
upper(TOT_N_SHEET) FROM " & TableName & " WHERE N_GEN='" & n_gen & "' AND 
N_SHEET='" & n_sheet & "' AND TOT_N_SHEET='" & tot_n_sheet & "'")

   

  if (not SQLN_GEN.eof) then
   * set n_gen + 1  
  else
   * leave n_gen the way it is
  end if

   

  conn.Execute strSQL


  But how can i ask it to change the n_gen value??? (The part with the *) 

   

  Thanks

   

  Shavonne Wijesinghe



  __ Information from ESET Smart Security, version of virus signature 
database 2863 (20080211) __

  The message was checked by ESET Smart Security.

  http://www.eset.com


Re: [SQL] Bouncing replies

2008-02-11 Thread Dave Page
On Feb 11, 2008 9:30 AM, Dean Gibson (DB Administrator)
<[EMAIL PROTECTED]> wrote:
>
>  PostgreSQL list serve output has not been connecting from
> mail.postgresql.org for a LONG time (see the headers below).  Currently
> they've been connecting from various hosts at the hub.org domain, but there
> have several other non-postgresql.org connecting domains in the past.
> Whenever I stop getting PostgreSQL mail, I go check my Postfix logs to see
> what the new hostname's domain is, and update my whitelist.

Without wishing to sound pedantic, the list server itself which was
what you asserted kept changing has in fact not changed. Looking at
the headers I see the message has been relayed through the spam
filtering at hub.org as well which I didn't realise Marc was doing (I
thought he only checked incoming posts), but regardless, all mail
should be coming only from hub.org/postgresql.org machines. I'd be
interested to see where else you've seen it come from, and when.

-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
The Oracle-compatible database company

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] Serial not nulla

2008-02-11 Thread Shavonne Marietta Wijesinghe
Thanks alot Shane..Just what I wanted.. Didn't think of a solution with 3 
primary keys.


Have a nice day ^___^


Shavonne Wijesinghe
www.studioform.it


- Original Message - 
From: "Shane Ambler" <[EMAIL PROTECTED]>

To: "Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, February 08, 2008 2:17 PM
Subject: Re: [SQL] Serial not nulla



Shavonne Marietta Wijesinghe wrote:

Hello

I am working with a database that has a Index number defined as Serial 
NOT NULL


I used this because,
1. I want to make sure that when many users login at the same time the 
Index number won't be repeated.

2. I don't have to increment it by programming (I use ASP)

But now i have a situation that i need to index numbers. For Example i 
could have a structure like this


INDEX1 - N_SHEET - TOT_SHEET
1 - 1 - 1
2 - 1 - 3
2 - 2 - 3
2 - 3 - 3

N_SHEET and TOT_SHEET are filled by the user (via web) but i need to hold 
on to the INDEX. And while userA is filling the 3 row if userB loggs in i 
need to provide the INDEX1 with 3.


Any idea??



As well as using the "Serial NOT NULL" you have also defined this column 
as PRIMARY KEY (or a unique index) which is what is preventing the 
duplicates in that column. (A primary key is enforced with a unique index)



From the sample shown you can use all three columns as the primary key 
with something similar to -


ALTER TABLE my_user_sheets DROP CONSTRAINT my_user_sheets_pkey;
ALTER TABLE my_user_sheets ADD PRIMARY KEY ("INDEX1", "N_SHEET", 
"TOT_SHEET");


(this implies that for each user they will have only one row for each 
combination of N_SHEET and TOT_SHEET) If you need to allow them to select 
the same 2 sheet numbers more than once then I would suggest you have an 
extra column for a primary key and redefine INDEX1 as the user_id. (or 
just add a user_id column and leave the INDEX1 as it is)




It's not recommended but you could also have the table without a primary 
key allowing duplicate value combinations. This would prevent you updating 
a single row though.




--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz 



---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


[SQL] Usage of UUID with 8.3 (Windows)

2008-02-11 Thread ncode
Hello list,

the UUID datatype in the recent version is a feature we intend to use in the 
near future. To generate a UUID in the database, the Linux release includes 
contrib modules which can be used for that (together with the uuid lib).

Now, what do I have to do in order to generate a valid UUID (or the 5 different 
versions as implemented by the RFC) under Windows?

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [SQL] Bouncing replies

2008-02-11 Thread Dean Gibson (DB Administrator)
PostgreSQL list serve output has not been connecting from 
mail.postgresql.org for a LONG time (see the headers below).  Currently 
they've been connecting from various hosts at the hub.org domain, but 
there have several other non-postgresql.org connecting domains in the 
past.  Whenever I stop getting PostgreSQL mail, I go check my Postfix 
logs to see what the new hostname's domain is, and update my whitelist.


While mail may originally come from a postgresql.org host, as I'm sure 
you know, the only information that a receiving SMTP server can trust is 
the connecting IP address and the hostname from a DNS reverse IP 
lookup.  Everything else can be falsified.  That's why virtually all 
SMTP-level spam filtering (including all DNS blacklist lookups) is based 
on the connecting IP address.


-- Dean

 Original Message 
Return-Path:<[EMAIL PROTECTED]>
X-Original-To:  ***
Delivered-To:   ***
Received: 	from mail.mailpen.net (mail.mailpen.net [209.90.228.14]) by 
sc440a.internal.mailpen.net (Postfix) with ESMTP id 384105444E9 for 
<***>; Mon, 11 Feb 2008 00:56:14 -0800 (PST)
Received: 	by mail.mailpen.net (Postfix) id D33062FE81D; Mon, 11 Feb 
2008 00:56:13 -0800 (PST)

Delivered-To:   ***
Received: 	from maia-1.hub.org (maia-1.hub.org [200.46.204.191]) by 
mail.mailpen.net (Postfix) with ESMTP id 952632FE802 for <***>; Mon, 11 
Feb 2008 00:56:11 -0800 (PST)
Received: 	from postgresql.org (postgresql.org [200.46.204.71]) by 
maia-1.hub.org (Postfix) with ESMTP id 6734DDB3A14; Mon, 11 Feb 2008 
04:56:07 -0400 (AST)
Received: 	from localhost (unknown [200.46.204.184]) by postgresql.org 
(Postfix) with ESMTP id 14BEC2E030B for 
<[EMAIL PROTECTED]>; Mon, 11 Feb 2008 04:54:09 
-0400 (AST)
Received: 	from postgresql.org ([200.46.204.71]) by localhost 
(mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 
80826-05 for <[EMAIL PROTECTED]>; Mon, 11 Feb 2008 
04:54:01 -0400 (AST)
Received: 	from wx-out-0506.google.com (wx-out-0506.google.com 
[66.249.82.231]) by postgresql.org (Postfix) with ESMTP id 108552E0306 
for ; Mon, 11 Feb 2008 04:54:04 -0400 (AST)
Received: 	by wx-out-0506.google.com with SMTP id r21so3723208wxc.28 for 
; Mon, 11 Feb 2008 00:54:04 -0800 (PST)
Received: 	by 10.151.144.4 with SMTP id w4mr905002ybn.199.1202720044201; 
Mon, 11 Feb 2008 00:54:04 -0800 (PST)

Received:   by 10.150.96.5 with HTTP; Mon, 11 Feb 2008 00:54:04 -0800 (PST)
Message-ID: <[EMAIL PROTECTED]>
Date:   Mon, 11 Feb 2008 08:54:04 +
From:   Dave Page <***>
To: Dean Gibson (DB Administrator) <***>
Subject:Re: [SQL] Bouncing replies
Cc: pgsql-sql@postgresql.org
In-Reply-To:<[EMAIL PROTECTED]>
MIME-Version:   1.0
Content-Type:   text/plain; charset=ISO-8859-1
Content-Transfer-Encoding:  7bit
Content-Disposition:inline
References: 	<[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]>

X-Virus-Scanned:Maia Mailguard 1.0.1
X-Mailing-List: pgsql-sql
List-Archive:   
List-Help:  
List-ID:
List-Owner: 
List-Post:  
List-Subscribe: 
List-Unsubscribe:   
Precedence: bulk
Sender: [EMAIL PROTECTED]
Status: O
X-UID:  25516
Content-Length: 1252
X-Keywords: 



On Feb 11, 2008 5:06 AM, Dean Gibson (DB Administrator) wrote:

If mail to my list address doesn't come from one of your list
servers (and those seems to change much more often than any other list I
belong to), it gets rejected.


Those must be some *really* long-lived lists. Our mailserver has been
mail.postgresql.org for probably 7 or 8 years now. Many moons ago we
did use some additional relay servers, but I don't think we've done
that for 5+ years.




Re: [SQL] Usage of UUID with 8.3 (Windows)

2008-02-11 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> Figure out how to build ossp-uuid on Windows ...

> I think Windows has its own UUID generator, so the best bet would be to
> make that work.

Only if it can be made to present the same SQL-level API as we have for
OSSP.  Otherwise we'll be faced with boatloads of platform-dependent
client code ...

regards, tom lane

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Jean-David Beyer
Shavonne Marietta Wijesinghe wrote:
> Thanks for the reply Grogory. I am trying to do a INSERT INTO.
> 
> Here is my table. n_gen, n_sheet, tot_n_sheet are defined as Primary Key
> (Serial not null)

That is sure confusing. What could a DDL saying

   INTEGER n_gen SERIAL NOT NULL;
   INTEGER n_sheet SERIAL NOT NULL;
   INTEGER tot_n_sheet SERIAL NOT NULL;
   PRIMARY KEY (n_gen, n_sheet, tot_n_sheet)

mean? Is this what your DDL says? Do you enter rows of this table specifying
the id and expecting the three serial generators to pick non-null sequential
numbers for the other three fields? I think you are very unclear about what
is going on here. Are you perhaps saying the table has three (distinct)
primary keys? Because if you assign them values, why would they be SERIAL?

>   id | n_gen | n_sheet   | tot_n_sheet
> --+---+---+-
> a|  1| 1 |  1
> b|  2| 1 |  2
> x|  2| 2 |  2
> u|  3| 1 |  1
> r|  4| 1 |  3
> a|  4| 2 |  3
> s|  4| 3 |  3
> 
> 
> So there are 2 users inserting in to the db. In my ASP page i have a
> field that shows the value of n_gen +1. So when the 2 users both login
> at the same time, with different sessions, they both see "7" in the
> n_gen field. But when they click on the sumbit button only one record is
> inserted and the other is lost.

Whatever you are doing that I do not understand with your keys, if you have
two users doing inserts on the same table, would you not have to run this
with Serializable Isolation Level (12.2.2. in the manual)? Would this not
fix your problem especially if you have a SERIAL as primary key?
> 
> I though it was possible to change the SQL string before it does the
> update.. But i can't seem to find a solution for it.. Any idea ??
> 



-- 
  .~.  Jean-David Beyer  Registered Linux User 85642.
  /V\  PGP-Key: 9A2FC99A Registered Machine   241939.
 /( )\ Shrewsbury, New Jerseyhttp://counter.li.org
 ^^-^^ 11:35:01 up 18 days, 1:21, 1 user, load average: 4.22, 4.28, 4.27

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Gregory Stark
"Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> writes:

> The user updates the DB via ASP. When 2 users click on the submit button at 
> the
> same time, only 1 record is inserted. (ERROR: duplicate key violates unique
> constraint "my_shevi_pkey")
>
> For example they both send a string like below.
> strSQL = INSERT INTO my_shevi VALUES ('a', 4, 1, 1);
>
> I thought of adding a test before executing the insert into. 

It's not clear to me what you're trying to do. If you're trying to update an
existing record then you might want something like example 37-1 on this page:

http://www.postgresql.org/docs/8.2/interactive/plpgsql-control-structures.html

If you want to pick the first available n_gen then you're going to have to
repeatedly try inserting until you don't get that error. That will perform
quite poorly when you get to large values. You could do a "SELECT max(n_gen)
WHERE..." first but even that will be quite a lot of work for your database.

Perhaps you should rethink n_gen and use a serial column to generate your
primary key instead.

> Set SQLN_GEN = oConn.Execute("SELECT upper(N_GEN), upper(N_SHEET),
> upper(TOT_N_SHEET) FROM " & TableName & " WHERE N_GEN='" & n_gen & "' AND
> N_SHEET='" & n_sheet & "' AND TOT_N_SHEET='" & tot_n_sheet & "'")

For what it's worth your script is a security hole. Look into using query
parameters which in ASP will probably be represented by "?". The method above
will allow hackers to get direct access to your database and do nasty things.

-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com
  Ask me about EnterpriseDB's RemoteDBA services!

---(end of broadcast)---
TIP 6: explain analyze is your friend


[SQL] Check before INSERT INTO

2008-02-11 Thread Shavonne Marietta Wijesinghe
My table structure

CREATE TABLE my_shevi
(
  id text,
  n_gen serial NOT NULL,
  n_sheet serial NOT NULL,
  tot_sheet serial NOT NULL,
  CONSTRAINT my_shevi_pkey PRIMARY KEY (n_gen, n_sheet, tot_sheet)
) 
WITH OIDS;
ALTER TABLE my_shevi OWNER TO postgres;

The user updates the DB via ASP. When 2 users click on the submit button at the 
same time, only 1 record is inserted. (ERROR:  duplicate key violates unique 
constraint "my_shevi_pkey")

For example they both send a string like below.
strSQL = INSERT INTO my_shevi VALUES ('a', 4, 1, 1);

I thought of adding a test before executing the insert into. 

Set SQLN_GEN = oConn.Execute("SELECT upper(N_GEN), upper(N_SHEET), 
upper(TOT_N_SHEET) FROM " & TableName & " WHERE N_GEN='" & n_gen & "' AND 
N_SHEET='" & n_sheet & "' AND TOT_N_SHEET='" & tot_n_sheet & "'")

if (not SQLN_GEN.eof) then
 * set n_gen + 1  
else
 * leave n_gen the way it is
end if

conn.Execute strSQL

But how can i ask it to change the n_gen value??? (The part with the *) 

Thanks

Shavonne Wijesinghe