Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
EdmondsM #1
Use a CFC to update a database with a date
Hi All, I am trying to input a date in a database field with the current date.
The datefield is in one table and I only want the date to be inserted if the ID
fields are equal to each other between the two tables. Can I put two
different queries in one cffunction?? The first query would query the first
table for the tbl ID. The second query would do the update based on the where
clause (where tbl1ID = tbl2ID). Am I way of track with this one. If I didn't
make it clear please let me know.
Thanks in advance
Maurice
EdmondsM Guest
-
mySQL Update Date
i want to update the time portion of a date column without knowing or change the actually day. so if the list of dates were xDate 2006-01-12... -
Date() in SQL database
In Access I can set a default value in a date field by using Date(). How do I do this in an SQL Server database. Bill -
Update Access with today's date
I am creating a form to allow the user to enter new records to an Access database. I want to have a hidden field that enters the date of record... -
converting date into database date format(newbie)
Hi! U can convert "8-Aug-03" into mysql date which requires yyyy-mm-dd format as below. <?php date("Y-m-d",strtotime("8-Aug-03")); ?> -
Date update?
Does anyone know how to have the date on your home page update automatically? I can't find any code. Thanks in advance! --Nathan -
The ScareCrow #2
Re: Use a CFC to update a database with a date
I can't see any reason why you could not do this, but there is no need. This
can be done in the single query
With one query
Update Table2
Set dateColumn = #Now()#
Where idColumn IN (Select idColumn From Table1)
To do it with 2 queries
<cfquery name="qry_getIds" datasource="DSN">
Select idColumn From Table1
</cfquery>
<cfset returnedIDS = ValueList(qry_getIds.idColumn)>
<cfquery name="qry_Update" datasource="DSN">
Update Table2
Set dateColumn = #Now()#
Where idColumn IN (#returnedIDS#)
</cfquery>
Ken
The ScareCrow Guest
-
EdmondsM #3
Re: Use a CFC to update a database with a date
Hi Ken, this does add the date to datefield in the db. But the problem that I am having is more than the record is being updated. I just want the record where both ID are equal.
Thanks
EdmondsM Guest
-
The ScareCrow #4
Re: Use a CFC to update a database with a date
You will need to post your code and the logic of what you want to achieve. If
you have a list of id numbers the query will only update where those numbers
are equal.
So in the example I gave it selects all the records from table1, so you may
need to filter the records from table one.
Ken
The ScareCrow Guest
-
EdmondsM #5
Re: Use a CFC to update a database with a date
Hi Ken, the code that I have is pretty much what you gave me. Yes, I am going
to have to filter the records based on the url value or hidden field. Can you
pass something like #url.variable# or #form.variable# to a CFC??
EdmondsM Guest
-
CF_Oracle #6
Re: Use a CFC to update a database with a date
You need to use something like the following example
<cfargument name="myName" required="true" type="string" displayname="myName">
in component's method
as well as WHERE MyColumn_Name = '#myName#' in query
and
<cfinvokeargument name="myName" value="#url.urlname#"> (or <cfinvokeargument
name="myName" value="#form.formname#">) - in calling page.
CF_Oracle Guest
-
EdmondsM #7
Re: Use a CFC to update a database with a date
Hey Ken, I finally got this to work. I ended up using a hidden field to pass the values that I wanted.
Thanks for your help
EdmondsM Guest



Reply With Quote

