CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 pulling data from one database, saving to another

Print topic Send  topic

Author Message
Chris__T


Posts: 339
Posted: 03/09/2006, 9:10 AM

Is it possible to pull data from one database into a form, then add a little more info to this form, then have it save to a different database?

My plan is that the user enters a Permit number. Pressing the button will bring up a few fields from this permit database, and place in the form. Then the user adds the extra info they need to add to the blank fields below the stuff that was pulled in. Then they'd press the 'save' button at the bottom, and it would save this form to a different database.

Is this possible?
View profile  Send private message
Chris__T


Posts: 339
Posted: 03/09/2006, 11:31 AM

Or possibly....from one table to another, but using the same form?

If I have a "search" form that asks for Permit Number. I type in "12345" and hit submit. It then takes me to a form where it pulled data from table Permit and placed it in the form (data being a name, address, phone number, etc.)

Now below this data, there are blank fields that are filled in by the user. These are fields that are not saved in the original table with the original data. These are fields like "Date", "time","comments", "type of inspection", etc.

Then after the user is done, i'd like them to be able to hit another button, and it saves this new "form" into a different table.

How can you do that if the form is set up to bring data in from Table 1. You can't set it up to pull from table 1 and send to table 2, can you?
View profile  Send private message
mhope

Posts: 37
Posted: 03/09/2006, 1:25 PM

Yes, that’s possible – you will need to do some custom code though in an after update event like:

Dim Connection
Set Connection = New clsDBYourDatabaseConnection
Connection.Open
Connection.Execute("UPDATE YourTable SET Field1='WhatEver', date_logout=Now() WHERE UserID="&CCGetUserID)
Connection.Close
Set Connection = Nothing

You will need the change the update statement to suit your requirements

Hope this helps
View profile  Send private message
Chris__T


Posts: 339
Posted: 03/10/2006, 8:30 AM

So basically, that custom code (when update event is executed) opens a new connection (for the 2nd table) and sends the form to that table? I'm assuming I need the same fields in table 2 as were in table 1.

Thanks for the advice. I'll try it out and update with the results.
View profile  Send private message
Chris__T


Posts: 339
Posted: 03/16/2006, 12:00 PM

I actually did a different way, provided you don't have to do any updating/inserting to the original table. (table1)

You modify the 'insert' and 'update' methods. First I switched the names, so the insert method is called 'update' and vice versa. This allows the button to show up on the form, because the insert won't show if you have pulled data from the table1.

Then in this new "update" table (which is actually the insert method), just switch the table name from table1 to table2. It works.
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.