Solved

Insert date in MS SQL

Posted on 2007-12-01
5
1,752 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now