Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create ODBC Date

Status
Not open for further replies.

hevychevy1996

Programmer
Jan 7, 2005
24
US
I created an online application submitting to itself. I have the code below for the beginning of my cfquery: I am having a problem with the date. app_date is the date field i am using. When i test it out i receive error executing database query. N E ideas?
Thanks in advance

Code:
#CreateODBCDate(FORM.app_date)
 
with out showing all your code or the exact error... grr...
my best guess is
Code:
###CreateODBCDate(FORM.app_date)###

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
ok you ask and you will receive:

Code:
<cfif IsDefined("FORM.Submit")>
  <cfquery datasource="WTG" name="insert_rec">
  INSERT INTO emp_app (
  #CreateODBCDate(FORM.app_date)#,
  last,
  first,
  middle,
  maiden,
  address_1,
  address_2,
  city,
  state,
  zip,
  social_security,
  phone,
  Alt_Number,
  birthday,
  under_18,
  position_applied,
  refer,
  refer_specify,
  salary_desired,
  no_pref,
  monday,
  tuesday,
  wednesday,
  thursday,
  friday,
  saturday,
  sunday,
  weekly_hours,
  nights,
  employment,
  date_available,
  school_1,
  location_1,
  years_completed_1,
  major_1,
  school_2,
  location_2,
  years_completed_2,
  major_2,
  school_3,
  location_3,
  years_completed_3,
  major_3,
  school_4,
  location_4,
  years_completed_4,
  major_4,
  work_ref_name_1,
  work_ref_position_1,
  work_ref_company_1,
  work_ref_address_1,
  work_ref_telephone_1,
  work_ref_name_2,
  work_ref_position_2,
  work_ref_company_2,
  work_ref_address_2,
  work_ref_telephone_2,
  convicted,
  convicted_specify,
  drivers_license,
  transportation,
  drivers_license_number,
  drivers_license_state,
  drivers_license_specify,
  drivers_license_expiration_date,
  word,
  excel,
  powerpoint,
  typing,
  typing_wpm,
  pc,
  mac,
  specify_skills,
  specify_other_skills,
  ref_name_1,
  ref_position_1,
  ref_company_1,
  ref_address_1,
  ref_phone_1,
  ref_name_2,
  ref_position_2,
  ref_company_2,
  ref_address_2,
  ref_phone_2,
  armed_forces,
  national_guard,
  specialty,
  date_entered,
  discharge_date)
VALUES(
'#CreateODBCDate(FORM.app_date)#',
'#FORM.last#',
'#FORM.first#',
'#FORM.middle#',
'#FORM.maiden#',
'#FORM.address_1#',
'#FORM.address_2#',
'#FORM.city#',
'#FORM.state#',
'#FORM.zip#',
'#FORM.social_security#',
'#FORM.phone#',
'#FORM.Alt_Number#',
'#FORM.birthday#',
'#FORM.under_18#',
'#FORM.position_applied#',
'#FORM.refer#',
'#FORM.refer_specify#',
'#FORM.salary_desired#',
'#FORM.no_pref#',
'#FORM.monday#',
'#FORM.tuesday#',
'#FORM.wednesday#',
'#FORM.thursday#',
'#FORM.friday#',
'#FORM.saturday#',
'#FORM.sunday#',
'#FORM.weekly_hours#',
'#FORM.nights#',
'#FORM.employment#',
'#FORM.date_available#',
'#FORM.school_1#',
'#FORM.location_1#',
'#FORM.years_completed_1#',
'#FORM.major_1#',
'#FORM.school_2#',
'#FORM.location_2#',
'#FORM.years_completed_2#',
'#FORM.major_2#',
'#FORM.school_3#',
'#FORM.location_3#',
'#FORM.years_completed_3#',
'#FORM.major_3#',
'#FORM.school_4#',
'#FORM.location_4#',
'#FORM.years_completed_4#',
'#FORM.major_4#',
'#FORM.work_ref_name_1#',
'#FORM.work_ref_position_1#',
'#FORM.work_ref_company_1#',
'#FORM.work_ref_address_1#',
'#FORM.work_ref_telephone_1#',
'#FORM.work_ref_name_2#',
'#FORM.work_ref_position_2#',
'#FORM.work_ref_company_2#',
'#FORM.work_ref_address_2#',
'#FORM.work_ref_telephone_2#',
'#FORM.convicted#',
'#FORM.convicted_specify#',
'#FORM.drivers_license#',
'#FORM.transportation#',
'#FORM.drivers_license_number#',
'#FORM.drivers_license_state#',
'#FORM.drivers_license_specify#',
'#FORM.drivers_license_expiration_date#',
'#FORM.word#',
'#FORM.excel#',
'#FORM.powerpoint#',
'#FORM.typing#',
'#FORM.typing_wpm#',
'#FORM.pc#',
'#FORM.mac#',
'#FORM.specify_skills#',
'#FORM.specify_other_skills#',
'#FORM.ref_name_1#',
'#FORM.ref_position_1#',
'#FORM.ref_company_1#',
'#FORM.ref_address_1#',
'#FORM.ref_phone_1#',
'#FORM.ref_name_2#',
'#FORM.ref_position_2#',
'#FORM.ref_company_2#',
'#FORM.ref_address_2#',
'#FORM.ref_phone_2#',
'#FORM.armed_forces#',
'#FORM.national_guard#',
'#FORM.specialty#',
'#FORM.date_entered#',
'#FORM.discharge_date#')
  </cfquery>
  <cfmail subject="A new application has been submitted" from="admin@company.net" to="hr@company.net" type="html">
    <table width="48%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
<td width="265"><div align="right">Date: </div></td>
<td width="200">#form.app_date#</td>
      </tr>
       <tr>
 <td><div align="right">Last Name: </div></td>
<td>#form.last#</td>
     </tr>
     <tr>
<td><div align="right">First Name: </div></td>
<td>#form.first#</td>
      </tr>
      <tr>
<td><div align="right">Middle: </div></td>
<td>#form.middle#</td>
     </tr>
     <tr>
<td><div align="right">Maiden:</div></td>
<td>#form.maiden#</td>
     </tr>
     <tr>
<td><div align="right">Address 1:</div></td>
<td>#form.address_1#</td>
</tr>
 	<tr>
<td><div align="right">Address 2:</div></td>
<td>#form.address_2#</td>
        </tr>
													<tr>
<td><div align="right">City:</div></td>
<td>#form.city#</td>
	</tr>
       <tr>
<td><div align="right">State:</div></td>
<td>#form.state#</td>
                  </tr>
                  <tr>
<td><div align="right">Zip Code: </div></td>
<td>#form.zip#</td>
                  </tr>
                  <tr>
<td><div align="right">Social Security Number:</div></td>
<td>#form.social_security#</td>
                 </tr>
                  <tr>
<td><div align="right">Telephone Number:</div></td>
<td>#form.phone#</td>
                 </tr>
																		   <tr>
                                                                            <td><div align="right">Alternate Number:</div></td>
                                                                            <td>#form.Alt_Number#</td>
                                                                          </tr>
                                                                          <tr>
                                                                            <td><div align="right">Date of Birth:</div></td>
                                                                            <td>#form.birthday#
																			
                                                                            </td>
                                                                          </tr>
																		    <tr>
                                                                            <td><div align="right">If under 18, please list age:</div></td>
                                                                            <td>#form.under_18#
																			</td>
                                                                          </tr>
																		    <tr>
                                                                            <td><div align="right">Position applied for:</div></td>
                                                                            <td>#form.position_applied#</td>
                                                                          </tr>
																		  <tr>
																		  <td><div align="right">Did an emloyee at Winn Technology Group refer you?</div></td>
																		  <td>#form.refer#</td>
																		  </tr>
																		  <tr>
																		  <td><div align="right">Please specify name of employee:</div></td>
																		  <td>#form.refer_specify#</td>
																		  </tr>
																		      <tr>
                                                                            <td><div align="right">Salary 
            desired (be specifc):</div></td>
                                                                            <td>#form.salary_desired#</td>
                                                                          </tr>
																		   </tr>
																		  <tr>
																		  <td>&nbsp;</td>
																		  </tr>
																		  	      <tr>
                                                                            <td><div align="right">Days/hours 
            available:</div></td>
                                                                            <td></td>
                                                                          </tr>
																		  <tr>
																		  <td></td>
																		  </tr>
																		  	      <tr>
                                                                            <td><div align="right">No pref:</div></td>
                                                                            <td>#form.no_pref#</td>
                                                                          </tr>
																		   	      <tr>
                                                                            <td><div align="right">Monday:</div></td>
                                                                            <td>#form.monday#</td>
                                                                          </tr>
																		   	      <tr>
                                                                            <td><div align="right">Tuseday:</div></td>
                                                                            <td>#form.tuesday#</td>
                                                                          </tr>
																		     	      <tr>
                                                                            <td><div align="right">Wednesday:</div></td>
                                                                            <td>#form.wednesday#</td>
                                                                          </tr>
																		     	      <tr>
                                                                            <td><div align="right">Thursday:</div></td>
                                                                            <td>#form.thursday#</td>
                                                                          </tr>
																		     	      <tr>
                                                                            <td><div align="right">Friday:</div></td>
                                                                            <td>#form.friday#</td>
                                                                          </tr>
																		     	      <tr>
                                                                            <td><div align="right">Saturday:</div></td>
                                                                            <td>#form.saturday#</td>
                                                                          </tr>
																		     	      <tr>
                                                                            <td><div align="right">Sunday:</div></td>
                                                                            <td>#form.sunday#</td>
                                                                          </tr>
																		   </tr>
																		  <tr>
																		  <td>&nbsp;</td>
																		  </tr>
																		     	      <tr>
                                                                            <td><div align="right">How many hours can you work weekly?</div></td>
                                                                            <td>#form.weekly_hours#</td>
                                                                          </tr>
																		     	      <tr>
                                                                            <td><div align="right">Can you work nights?</div></td>
                                                                            <td>#form.nights#
</td>
                                                                          </tr>
																		  	      <tr>
                                                                            <td><div align="right">Employment desired:</div></td>
                                                                            <td>#form.employment#>
</td></tr>															  
																		      	      <tr>
                                                                            <td><div align="right">When will you be available to work?</div></td>
                                                                            <td>#form.date_available#</td>
                                                                          </tr>																		  
                                                                        </table><br><br>
																		<table width="83%" border="2" align="center">
  <tr>
        <td width="16%" height="39" align="center">Type of School</td>
        <td width="37%" align="center">Name of School</td>
        <td width="35%" align="center">Location (Complete Mailing Address)</td>
        <td width="4%" align="center">Years Completed</td>
        <td width="45%" align="center">Major and Degree</td>
  </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center">High School</td>
    <td>#form.school_1#</td>
    <td>#form.location_1#</td>
    <td>#form.years_completed_1#</td>
    <td>#form.major_1#</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
        <td align="center">College/<br>
          University</td>
    <td>#form.school_2#</td>
    <td>#form.location_2#</td>
     <td>#form.years_completed_2#</td>
    <td>#form.major_2#</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
        <td align="center">Bus. or Trade School</td>
    <td>#form.school_3#</td>
    <td>#form.location_3#</td>
     <td>#form.years_completed_3#</td>
    <td>#form.major_3#</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
        <td align="center">Professional School</td>
    <td>#form.school_4#</td>
   <td>#form.location_4#</td>
     <td>#form.years_completed_4#</td>
    <td>#form.major_4#</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table><br><br>
<table width="75%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
										
        <td width="36%"><strong>Please list two previous employers. If you have 
          no previous work experience, type N/A in the required fields:</strong></td>
      </tr>
										<tr>
										<td>&nbsp;</td>
										</tr>
										<tr>
										<td align="right">Name:</td>
										<td width="64%">#form.work_ref_name_1#</td>
										</tr>
										<tr>
										<td align="right">Position:</td>
										<td>#form.work_ref_position_1#</td>
		  								</tr>
										<tr>
										<td align="right">Company:</td>
										<td>#form.work_ref_company_1#</td>
										</tr>
										<tr>
										<td align="right">Address:</td>
										<td>#form.work_ref_address_1#</td>
										</tr>
										<tr>
										<td align="right">Telephone:</div>
										<td>#form.work_ref_telephone_1#</td>
										</tr>
										<tr>
										<td align="right">&nbsp;</td>
										</tr>
										<tr>
										<td align="right">Name:</td>
										<td>#form.work_ref_name_2#</td>
										</tr>
										<tr>
										<td align="right">Position:</td>
										<td>#form.work_ref_position_2#</td>
										</tr>
																				<tr>
										<td align="right">Company:</td>
										<td>#form.work_ref_company_2#</td>
										</tr>
										<tr>
										<td align="right">Address:</td>
										<td>#form.work_ref_address_2#</td>
										</tr>
																				<tr>
										<td align="right">Telephone:</td>
										<td>#form.work_ref_telephone_2#</td></tr>
										</table>
<br><br>

																		<table width="48%"  border="0" cellspacing="0" cellpadding="0">
                                                                          <tr>
                                                                            <td width="55%"><div align="right">Have 
            you ever been convicted of a crime?</div></td>
                                                                            <td width="43%">#form.convicted#</td>
                                                                          </tr>
																		  <tr>
																		  <td>&nbsp;</td>
																		  </tr>
                                                                          <tr>
                                                                            <td><div align="right">If yes, explain number of conviction(s), nature of offense(s) leading to conviction(s), how recently such offense(s) was/were committed, sentence(s) imposed and type(s) of rehabilitation: </div></td>
                                                                            <td>#form.convicted_specify#</td>
                                                                          </tr>
																		  </tr>
																		  <tr>
																		  <td>&nbsp;</td>
																		  </tr>
                                                                          <tr>
                                                                            <td><div align="right">Do you have a driver license?</div></td>
                                                                            <td>#form.drivers_license#</td>
                                                                          </tr>
                                                                          <tr>
                                                                            <td><div align="right">What is your transportation to work?</div></td>
                                                                            <td>#form.transportation#</td>
                                                                          </tr>
                                                                          <tr>
                                                                            <td><div align="right">Drivers License Number:</div></td>
                                                                            <td>#form.drivers_license_number#</td>
                                                                          </tr>
                                                                          <tr>
                                                                            <td><div align="right">State of Issue:</div></td>
                                                                            <td>#form.drivers_license_state#
</td>
                                                                          </tr>
                                                                          <tr>
                                                                            <td><div align="right">Specify type of drivers license:</div></td>
                                                                            <td>#form.drivers_license_specify#</td>
                                                                          </tr>
																		     <tr>
                                                                            <td><div align="right">Expiration Date :</div></td>
                                                                            <td>#form.drivers_license_expiration_date#</td>
																			<td width="2%"></td>
                                                                          </tr>
													  </table><br><br>
										
    <table width="47%"  border="0" cellspacing="0" cellpadding="0">
										<tr>
										<td><div align="right">Are you familiar with Microsoft Word?</div></td>
										<td width="42%">#form.word#</td>
										</tr>
										<tr>
										<td><div align="right">Are you familiar with Microsoft Excel?</div></td>
										<td>#form.excel#</td>
		  								</tr>
										<tr>
										<td><div align="right">Are you familiar with Microsoft PowerPoint?</div></td>
										<td>#form.powerpoint#</td>
										</tr>
										<tr>
										<td><div align="right">Typing?<br>
WPM</div></td>
										<td>#form.typing#
										  <br>
#form.typing_wpm#</td>
										</tr>
										<tr>
										<td><div align="right">Have you worked on a personal computer?</div></td>
										<td>#form.pc#</td>
										</tr>
										<tr>
										<td><div align="right">Have you worked on a Mac/Apple computer(s)?</div></td>
										<td>#form.mac#</td>
										</tr>
										<tr>
										<td><div align="right">Please specify any other computer related skills:</div></td>
										<td>#form.specify_skills#
										</td>
										</tr>
										<tr>
										<td><div align="right">Please describe 
            any specific/experience related to the position for which you are 
            applying:</div></td>
										<td>#form.specify_other_skills#
										</td>
										</tr>
										</table>
										<br>
<br>
								
										
    <table width="75%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
										
        <td width="36%"><strong>Please list two references other than relatives 
          or previous employers:</strong></td>
      </tr>
										<tr>
										<td>&nbsp;</td>
										</tr>
										<tr>
										<td align="right">Name:</td>
										<td width="64%">#form.ref_name_1#</td>
										</tr>
										<tr>
										<td align="right">Position:</td>
										<td>#form.ref_position_1#</td>
		  								</tr>
										<tr>
										<td align="right">Company:</td>
										<td>#form.ref_company_1#</td>
										</tr>
										<tr>
										<td align="right">Address:</td>
										<td>#form.ref_address_1#</td>
										</tr>
										<tr>
										<td align="right">Telephone:</div>
										<td>#form.ref_phone_1#</td>
										</tr>
										<tr>
										<td align="right">&nbsp;</td>
										</tr>
										<tr>
										<td align="right">Name:</td>
										<td>#form.ref_name_2#</td>
										</tr>
										<tr>
										<td align="right">Position:</td>
										<td>#form.ref_position_2#</td>
										</tr>
																				<tr>
										<td align="right">Company:</td>
										<td>#form.ref_company_2#</td>
										</tr>
										<tr>
										<td align="right">Address:</td>
										<td>#form.ref_address_2#</td>
										</tr>
																				<tr>
										<td align="right">Telephone:</td>
										<td>#form.ref_phone_2#</td></tr>										</table>
										
										<br><br>
    <table width="50%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
										<td width="53%"><strong>Military</strong></td>
										</tr>
										<tr>
										<td><div align="right">Have you ever been in the armed forces?</div></td>
<td width="47%">#form.armed_forces#</td>										</tr>
										<tr>
										<td><div align="right">Are you now a member of the national guard?</div></td>
<td>#form.national_guard#</td>										</tr>
										<tr>
										<td><div align="right">Specialty:</div></td>
										<td>#form.specialty#</td>
										</tr>
										<tr>
										<td><div align="right">Date Entered:</div></td>
										<td>#form.date_entered#</td>
										</tr>
											<tr>
										<td><div align="right">Discharge Date:</div></td>
										<td>#form.discharge_date#</td>
										</tr>
										</table>

</cfmail>
</cfif>
 
at the very top of your query

INSERT INTO emp_app (
#CreateODBCDate(FORM.app_date)#,

that should be the name of your date field not the date...

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
so where do i put the create odbc format? app_date is the field the users are entering the date into
 
the database needs a app_date field to store the form.app_date in. just like all the other field / value combinations in your query.

what you showed us is essentialy
INSERT INTO emp_app (
#CreateODBCDate(FORM.app_date)#)
VALUES
(#CreateODBCDate(FORM.app_date)#)

do you see it now?







 
weirdo.

what you showed us is essentialy
INSERT INTO emp_app (
#CreateODBCDate(FORM.app_date)#)
VALUES
(#CreateODBCDate(FORM.app_date)#)

should be
Code:
INSERT INTO emp_app ([b]app_date[/b])
VALUES 
  (###CreateODBCDate(FORM.app_date)###)

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
now when i use your way bomboy i receive this error message:

Code:
Error Executing Database Query.


[Macromedia][SequeLink JDBC Driver][ODBC Socket][MySQL][ODBC 3.51 Driver][mysqld-4.1.3-beta-max]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

The error occurred in C:\Inetpub\[URL unfurl="true"]wwwroot\vpn\emp_app\emp_app.cfm:[/URL] line 182



180 : '#FORM.specialty#',
181 : '#FORM.date_entered#',
182 : '#FORM.discharge_date#')
183 :   </cfquery>
184 :   <cfmail subject="A new application has been submitted" from="admin@company.net" to="hr@company.net" type="html">
 
without posting the entire query what do you have?

please just show the first few lins of the beginning and the first few lines after the keyword "values"

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
mysql is weird with dates.

also try
'#CreateODBCDate(FORM.app_date)#'

or
'#dateformat(now(), "dd-mm-yyyy")#'

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
that would be another way to do it. let CF deal with the sql syntax.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
ok i used the '#dateformat(now(), "dd-mm-yyyy")#' and it submitted fine. Only now it isnt showing the date in that format in my database? You want me to only change in the values portion corrcect?

Code:
VALUES(
'#dateformat(now(), "dd-mm-yyyy")#',
'#FORM.last#',
 
what format is it in?

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
This is what i am receiving for a date after an application has been submitted:

0000-00-00

This is what i receive if someone put for example: 2-16-05
 
looks like its yyyy-dd-mm try that in your dateformat. where's rudy when you need him? :)

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
i changed it to that format but i am still receiving zeros where i entered the date on the application
 
lets see you're query now

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Code:
  INSERT INTO emp_app (
  app_date,

VALUES(
'#dateformat(now(), "yyyy-dd-mm")#',
 
try
INSERT INTO emp_app (
app_date,

VALUES(
###dateformat(now(), "yyyy-dd-mm")###,

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top