CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Modify SQL CMD Before Execute Insert

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 04/22/2005, 12:55 PM

In a record form...

From the Before_Execute_Insert event, I can't seem to figure out how to access the SQL string which actually inserts a row. The property is Cmd but I can't figure out how to address it without throwing an error that the object doesn't exist.

I would like to modify that string to suit so that the record is inserted with various defaults columns.

How do I address this thing?

Function SOHEADERS_DataSource_BeforeExecuteInsert()

TIA,

---JC
_________________
---On a campaign for more examples and better docs!
View profile  Send private message
Suntower

Posts: 225
Posted: 04/22/2005, 3:11 PM

Anyone?

Driving me insane-o!!!

---JC
_________________
---On a campaign for more examples and better docs!
View profile  Send private message
DonB
Posted: 04/23/2005, 12:57 PM

For what you are doing (assigning default values) I'd first attempt to
define those in the database itself. Assuming that's not possible, I'd
consider the Custom Insert property to set those values (note that you can
select expressions to provide the default values and these can be functions
you write, if these values are complex and/or calculated rather than mere
constants).

However, to to this in the event handler, the object reference will be

Eventcaller.Connection.Execute("Some SQL query") to perform some operation
directly.

To affect the query that will be executed by the form's INSERT, you need to
use the Before Build Select and modify the values of

Eventcaller.SQL and/or Eventcaller.Where

which are text strings that , together, are the actual INSERT statement that
will be executed. You can't set these properties in the Before Execute
event - that's too late, the query has already been built.

--
DonB

http://www.gotodon.com/ccbth


"Suntower" <Suntower@forum.codecharge> wrote in message
news:6426956951fbd2@news.codecharge.com...
> In a record form...
>
> From the Before_Execute_Insert event, I can't seem to figure out how to
access
> the SQL string which actually inserts a row. The property is Cmd but I
can't
> figure out how to address it without throwing an error that the object
doesn't
> exist.
>
> I would like to modify that string to suit so that the record is inserted
with
> various defaults columns.
>
> How do I address this thing?
>
> Function SOHEADERS_DataSource_BeforeExecuteInsert()
>
> TIA,
>
> ---JC
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Nicole

Posts: 586
Posted: 04/25/2005, 2:09 AM

Suntower,
Try to use
Form_name.Command.SQL

_________________
Regards,
Nicole
View profile  Send private message
Suntower

Posts: 225
Posted: 04/26/2005, 11:09 AM

Perfect.

This may betray my own ignorance/incompetence, but...

HOW DO YOU FIGURE THIS STUFF OUT? Trial and error?

Is there some sort of 'Object Browser' of which I am unaware? I admit to not being the sharpest tool in the shed, but it isn't obvious to me that the SQL property is a member of the FormName. Command class.

Any tips on learning how to reference various properties/methods?

---JC


Quote Nicole:
Suntower,
Try to use
Form_name.Command.SQL


_________________
---On a campaign for more examples and better docs!
View profile  Send private message
Nicole

Posts: 586
Posted: 04/27/2005, 1:59 AM

Suntower,
To find this code I looked at the generated page code to check the classes used to display form and update database data. After several trials I found the right code :-)

_________________
Regards,
Nicole
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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