CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 autoincrement in CCS

Print topic Send  topic

Author Message
Guy


Posts: 60
Posted: 09/16/2006, 5:24 AM

Hello,

In other post, i saw that it's possible to ckeck the autoincrement in CCS.
I have a form to add record and i want to check it.
I never find it.
Could you help me please ?

_________________
CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
Guy
View profile  Send private message
peterr


Posts: 5971
Posted: 09/16/2006, 12:25 PM

I'm not sure what do you mean "check the autoincrement"? You just need to have an autoincrement field in the database and it should work. Nothing needs to be done in CCS since it's the database functionality to increment fields.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Dave Malen
Posted: 09/17/2006, 12:20 AM

Hi

Are you trying to retrieve the value of the autoinc field?

"Guy" <Guy@forum.codecharge> wrote in message
news:2450becff3f19b@news.codecharge.com...
> Hello,
>
> In other post, i saw that it's possible to ckeck the autoincrement in CCS.
> I have a form to add record and i want to check it.
> I never find it.
> Could you help me please ?
>
> _________________
> CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
> Guy
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Guy


Posts: 60
Posted: 09/17/2006, 12:52 AM

Hello,
I thank that there was a field to check for this, because when you use a template to create application you can check "autoincrement key". I ask me Why ?
Thanks for help.
_________________
CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
Guy
View profile  Send private message
peterr


Posts: 5971
Posted: 09/17/2006, 10:52 PM

There is no such field and no need for one. Builders provide such option only to include the key field on your form. If it's not included then your database must increment it automatically.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Guy


Posts: 60
Posted: 09/18/2006, 11:09 AM

My database don't have autoincrement (i don't want)
How can do the autoincrement in CCS. Is it possible ? or I must do by handcoded ? and how ?
_________________
CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
Guy
View profile  Send private message
peterr


Posts: 5971
Posted: 09/18/2006, 11:54 AM

You can add the key field into your form and allow your users to enter some value into it. If you prefer to increment it yourself via custom code then you could do this in "Before Insert" or "Before Build Insert" event.

and how ?
In case no one else provides specific code, my answer would be that that you should decide and describe how you want to do this :-)
I suspect that there are several ways to manage key increments, for example using sequences like in Oracle, and/or creating a new empty record and then updating it, or reading last key and increementing it directly, etc. Since you made the decision that you don't want to use the standard database-based increments then you may need to decide what you want to do instead. At minimum you should research this subject (Google) and learn about different methods, locking mechanisms of your database, concurrency issues and other risks involved, etc. You can also add your own requirements and then make the decision on how to implement this.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Guy


Posts: 60
Posted: 09/18/2006, 12:29 PM

Hi peterr and thank you
I use mssql and i have use a specific code for autoincrement with the 'select max..)
For this it's ok, but my problem is for update database. I want use the normal update and i just want replace my result to pointcli.
My code in before insert :
//Custom Code @39-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
global $DBVentauto;
$pointclimax = 0;
$wheresql = "";
$pointclimax = CCDLookUp("max(pointcli)","CLIENT",$wheresql,$DBVentauto)+1;
//End Custom Code
The result it's ok but now how to pass this result in update database ?


_________________
CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
Guy
View profile  Send private message
peterr


Posts: 5971
Posted: 09/18/2006, 12:52 PM

Probably the best way would be to include the key field in your form as Hidden control, and then assign the new value to it, like:
$FormName->HiddenName->SetValue($pointclimax);
I'm only concerned that your code may not always work in multi-user environment where several keys may be incremented at the same time.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
jres
Posted: 09/18/2006, 10:44 PM

Hi!
If you use MSSql server you can set for PK field 'Identity'='Yes' and looks this field as autoincrement field.

something like this
CREATE TABLE [ages] (
[age_id] [int] IDENTITY (1, 1) NOT NULL ,
[age_name] [varchar] (50) NULL
) ON [PRIMARY]

or use enterprise manager to do it
Guy


Posts: 60
Posted: 09/19/2006, 11:52 AM

Hello,
jres -> i don't want my database do the autoincrement
peterr -> with hiding field and the small code it's ok

Thank you

But a another question.
In my form i putted a link to add a record and i wan't come back to my form after add record but without put the return page in constant.
How can i do this ?

Thanks for the first problem.

_________________
CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
Guy
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.