Solved

Insert date in MS SQL

Posted on 2007-12-01
5
1,766 Views
Last Modified: 2010-08-05
Hallo Experts.
I try to have a date when i insert an artikel in a db table.
The table is t_artikel
One column is called hersteller_pkw_id and the other is the datein.
What changes must i do in the following code which is made with  webassist-dataassist extension?
<cfif (isDefined("Form.Insert.x")) >
  <cfset WA_connection = "carfree24" />
  <cfset WA_insTable = "dbo.t_artikel" />
  <cfset WA_sessionName = "WADA_Insert_dbot_artikel" />
  <cfset WA_redirectURL = "t_artikel_Detail.cfm" />
  <cfset WA_keepQueryString = false>
  <cfset WA_indexField = "art_id" />
  <cfset WA_fieldNamesStr = "hersteller_pkw_id|Datein" />
  <cfset WA_fieldValuesStr = "" & ToString(IIf(isDefined("Form.hersteller_pkw_id"),"Form.hersteller_pkw_id",DE(""))) & "" & "|" & "" & ToString(IIf(isDefined("Form.Datein"),"Form.Datein",DE(""))) & "" />
  <cfset WA_columnTypesStr = "none,none,NULL|',none,NULL" />
  <cfset WA_comparisonStr = " = | = " />
  <cfset WA_fieldNames = WA_ListToArray(WA_fieldNamesStr,"|") />
  <cfset WA_fieldValues = WA_ListToArray(WA_fieldValuesStr,"|") />
  <cfset WA_columns = WA_ListToArray(WA_columnTypesStr,"|") />
  <cfset WA_comparisions = WA_ListtoArray(WA_comparisonStr, "|") />
  <cfset insertParamsObj = WA_AB_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues, -1) />.........
0
Comment
Question by:Panos
  • 2
5 Comments
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 20389079
Hi panosms,
What is the problem and what is your question?
Are you having problems inserting the date from the Form - Please give us some more details
0
 
LVL 2

Author Comment

by:Panos
ID: 20390671
Hallo BCUNNEY.
The problem is that i cannot get the date Now() in my db using this form.
When i use The INSERT INTO ...... VALUES........ Now() i have no problems but with this generated code from the extension i can't get it.I hope you did understand me now.
0
 
LVL 2

Accepted Solution

by:
Panos earned 0 total points
ID: 20390737
Hallo again.
I have fixed the code.The working code is
<cfif (isDefined("Form.Insert.x")) >
  <cfset WA_connection = "carfree24" />
  <cfset WA_insTable = "dbo.t_artikel" />
  <cfset WA_sessionName = "WADA_Insert_dbot_artikel" />
  <cfset WA_redirectURL = "t_artikel_Detail.cfm" />
  <cfset WA_keepQueryString = false>
  <cfset WA_indexField = "art_id" />
  <cfset WA_fieldNamesStr = "hersteller_pkw_id|Datein" />
  <cfset WA_fieldValuesStr = "" & ToString(IIf(isDefined("Form.hersteller_pkw_id"),"Form.hersteller_pkw_id",DE(""))) & "" & "|" & "" & ToString(DateFormat(Now() ,"dd/mm/yyyy")) & "" />
  <cfset WA_columnTypesStr = "none,none,NULL|',none,NULL" />
  <cfset WA_comparisonStr = " = | = " />
  <cfset WA_fieldNames = WA_ListToArray(WA_fieldNamesStr,"|") />
  <cfset WA_fieldValues = WA_ListToArray(WA_fieldValuesStr,"|") />
  <cfset WA_columns = WA_ListToArray(WA_columnTypesStr,"|") />
  <cfset WA_comparisions = WA_ListtoArray(WA_comparisonStr, "|") />
  <cfset insertParamsObj = WA_AB_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues, -1) />

Thank You.
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20631847
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question