Insert date format
Hi
Iam using jsp and oracle
I want to insert date in table in format
MONTHYYYY
i e JUNE2002
using prepared statement
regds
Hi I used following function to get the date in exact format
DateFormat formatter = new SimpleDateFormat("yyyy-mm-dd");
formatter.setLenient(false);
try
java.util.Date aDate = formatter.parse(val);
return true;
catch (java.text.ParseException e) {
return false;
}
Similar Messages
-
External table with Date Format
I have external table and in the file date format is YYYY-MM-DD.
i want to insert date format mask in the create table command .
the bleow command is getting created . But it is giving error when i use select command.
CREATE TABLE XADV.XADV_test_EXT_TABLE
BPO_START_DATE Date
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY XCRM_DASHBOARD
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY '|^|'
BPO_START_DATE date 'YYYY-MM-DD'
LOCATION (XCRM_DASHBOARD:'test.txt')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;
the error i am getting is in select * from XADV_test_EXT_TABLE
RA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "minussign": expecting one of: "column, enclosed, exit, (, ltrim, lrtrim, ldrtrim, missing, notrim, optionally, rtrim, reject"
KUP-01007: at line 3 column 3
ORA-06512: at "SYS.ORACLE_LOADER", line 19
regards
Manishoblock wrote:
use double quotes instead of single quotesHas nothing to do with the quotes. Issue is field list must be enclosed in parents:
SQL> CREATE TABLE XADV_test_EXT_TABLE
2 (
3 BPO_START_DATE Date
4 )
5 ORGANIZATION EXTERNAL
6 (
7 TYPE ORACLE_LOADER
8 DEFAULT DIRECTORY TMP
9 ACCESS PARAMETERS
10 (
11 RECORDS DELIMITED BY NEWLINE
12 FIELDS TERMINATED BY ','
13 BPO_START_DATE date "YYYY-MM-DD"
14 )
15 LOCATION (TMP:'test.txt')
16 )
17 REJECT LIMIT UNLIMITED
18 NOPARALLEL
19 NOMONITORING
20 /
Table created.
SQL> select * from XADV_test_EXT_TABLE
2 /
select * from XADV_test_EXT_TABLE
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "identifier": expecting one of: "column,
enclosed, exit, (, ltrim, lrtrim, ldrtrim, missing, notrim, optionally, rtrim,
reject"
KUP-01008: the bad identifier was: BPO_START_DATE
KUP-01007: at line 3 column 4
ORA-06512: at "SYS.ORACLE_LOADER", line 19
SQL> drop table XADV_test_EXT_TABLE;
Table dropped.
SQL> CREATE TABLE XADV_test_EXT_TABLE
2 (
3 BPO_START_DATE Date
4 )
5 ORGANIZATION EXTERNAL
6 (
7 TYPE ORACLE_LOADER
8 DEFAULT DIRECTORY TMP
9 ACCESS PARAMETERS
10 (
11 RECORDS DELIMITED BY NEWLINE
12 FIELDS TERMINATED BY ','
13 (
14 BPO_START_DATE date 'YYYY-MM-DD'
15 )
16 )
17 LOCATION (TMP:'test.txt')
18 )
19 REJECT LIMIT UNLIMITED
20 NOPARALLEL
21 NOMONITORING
22 /
Table created.
SQL> select * from XADV_test_EXT_TABLE
2 /
BPO_START
19-NOV-08
SQL> SY. -
Hi Everyone,
I have problem in inserting date format into a table where together with Arabic data like 'Arabic Data'||to_date(:date_field.date,'DD/MM/YYYY');
it is showing Mar-10-03 (Month-Year-day) instead of DD/MM/YYYY.
I would appreciate your help.
Thanks
Ahon[email protected] wrote:
Hi Everyone,
I have problem in inserting date format into a table where together with Arabic data like 'Arabic Data'||to_date(:date_field.date,'DD/MM/YYYY');
it is showing Mar-10-03 (Month-Year-day) instead of DD/MM/YYYY.
I would appreciate your help.
Thanks
AhonChange to this
'Arabic Data'||to_char(:date_field.date,'DD/MM/RRRR'); -
How can i insert date format to database? I used java.util.Date but I got SQL exception
Please Help ME..!!// this part of code will help you to insert the current date
// every authorizedDate with 0000-00-00 will be replaced by current date in authorizedBy table
// this works in mysql
PreparedStatement updateAuthorization=connection.prepareStatement(
"UPDATE authorizedBy SET authorizedDate = ? WHERE authorizedDate = '0000-00-00' ";
try{
//update authorization table
updateAuthorization.setDate(1,new java.sql.Date(new java.util.Date().getTime()));
updateAuthorization.executeUpdate();
catch ( SQLException e) {
// enter your exception message
} -
How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?
Hi
How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?
This is my Input data.
11/25/2007.
By using below query, it is inserted into database.
sql>Insert into tblname values(to_date('11/25/2007','MM/DD/YYYY'));
But using stored procedure, the same query is not running.
It shows error like
ORA-01843: not a valid month ORA-06512: at line 1
Procedure:
create or replace procedure Date_Test(datejoin in DATE) is
begin
insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
end Date_Test;
I had used 'nls_date_language = american' also.
Prcodeure is created but not worked in jsp. The same error is thrown.
Pls provide a solutionThis might help you....
SQL> Create Table DateTest(col1 Date);
Table created.
Elapsed: 00:00:00.00
SQL> create or replace procedure Date_Test(datejoin in DATE) is
2 begin
3 insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
4 end ;
5 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec Date_Test('11/25/2007');
BEGIN Date_Test('11/25/2007'); END;
ERROR at line 1:
ORA-01843: not a valid month
ORA-06512: at line 1
Elapsed: 00:00:00.00
SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
BEGIN Date_Test(To_Date('11/25/2007','mm/dd/yyyy')); END;
ERROR at line 1:
ORA-01843: not a valid month
ORA-06512: at "CTBATCH.DATE_TEST", line 3
ORA-06512: at line 1
Elapsed: 00:00:00.00
SQL> create or replace procedure Date_Test(datejoin in DATE) is
2 begin
3 insert into datetest values(datejoin);
4 end ;
5 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> Select * from DateTest;
COL1
25-NOV-07
Elapsed: 00:00:00.00
SQL> create or replace procedure Date_Test(datejoin in VarChar2) is
2 begin
3 insert into datetest values(to_date(datejoin,'mm/dd/yyyy'));
4 end ;
5 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec Date_Test('11/25/2007');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> select * from DateTest;
COL1
25-NOV-07
25-NOV-07
Elapsed: 00:00:00.00
SQL> -
How to insert the Formatted date value and insert into the database
Hi All,
I am having requirement of inserting the date value in to the datbase. I'm already getting the value from file as MM-DD-YYYY. Getting exception while transforming the values through the transform activity. I'm using format fate function but it is inserting null value in to the database.
Any help from anyone would bve appreciated.
Thanks,
CHHi,
your input date format is fixed right? So, in the transform you can split each your date, which is in 'MM-DD-YYYY' format ... extract day, month, year.
After that ... just put these values in order acording to the format of 'xsd:date' data type which is '[-]CCYY-MM-DDZ'.
XPath function 'xp20:format-dateTime()' works only with 'xsd:dateTime' data type, which has format '[-]CCYY-MM-DDThh:mm:ssZ'.
So, in your case it could be:
<xsl:variable name="day" select="substring($inputDate,4,2)"/>
<xsl:variable name="month" select="substring($inputDate,1,2)"/>
<xsl:variable name="day" select="substring($inputDate,7,4)"/>
<xsl:variable name="outputDate">
<xsl:value-of select="$year"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="$month"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="$day"/>
</xsl:variable>
Regards,
Martin. -
Date Format in servlet when i insert into database
I am inserting data into database through servlet, but i am getting NumberFormat Exception, and my datatype in database is DATE ,when i typecast my day and year because they r in int and changing into String,still i am getting the same error .So please can any one tell me where to cahnge the format of date and how to type cast to my Date format of database.
Thanks,
lalithaMy code is:import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.text.*;
import java.sql.Date;
import java.util.*;
public class RegisterServlet extends HttpServlet
Connection con;
PreparedStatement ps;
public void init(ServletConfig sc) throws ServletException
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:plk","scott","tiger");
System.out.println("connection created");
catch(Exception e)
System.out.println(e);
public void doPost(HttpServletRequest req, HttpServletResponse res)
try
res.setContentType("text/html");
PrintWriter pw= res.getWriter();
String ulogin=req.getParameter("login").trim();
String uph1=req.getParameter("ph1").trim();
int ph1=Integer.parseInt(uph1);
String upass=req.getParameter("pass").trim();
String uph2=req.getParameter("ph2").trim();
int ph2=Integer.parseInt(uph2);
String cpass=req.getParameter("cfm").trim();
String uweb=req.getParameter("web").trim();
String ufirst=req.getParameter("first").trim();
String uaddress=req.getParameter("address").trim();
String umiddle=req.getParameter("middle").trim();
String ucity=req.getParameter("city").trim();
String ulast=req.getParameter("last").trim();
String uzip=req.getParameter("zip").trim();
int zip=Integer.parseInt(uzip);
String ud=req.getParameter("Aday").trim();
String um=req.getParameter("Amonth").trim();
String uy=req.getParameter("Ayear").trim();
SimpleDateFormat din=new SimpleDateFormat("dd-mm-yyyy");
SimpleDateFormat dout=new SimpleDateFormat("yyyy/mm/dd");
String txtDate="2001-07-07";
Date date=din.parse(txtDate);
java.sql.Date dt=new java.sql.Date(txtDate);
dout.format(dt);
String usex=req.getParameter("sex").trim();
String uemail=req.getParameter("email").trim();
String ust=req.getParameter("st").trim();
String ucty=req.getParameter("cty").trim();
ps=con.prepareStatement("insert into Userdetails values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1,ulogin);
ps.setString(2,uph1);
ps.setString(3,upass);
ps.setString(4,uph2);
ps.setString(5,cpass);
ps.setString(6,uweb);
ps.setString(7,ufirst);
ps.setString(8,uaddress);
ps.setString(9,umiddle);
ps.setString(10,ucity);
ps.setString(11,ulast);
ps.setString(12,uzip);
ps.setDate(13,dt);
ps.setString(14,usex);
ps.setString(15,uemail);
ps.setString(16,ust);
ps.setString(17,ucty);
int i=ps.executeUpdate();
if(i==1)
pw.println("<h3><center> Thankyou! Your details have been stored. </center></h3>");
res.sendRedirect("http://localhost:8080/SeekLogin.html");
pw.close();
else
pw.println("<h3><center>Sorry! you are not registered properly. </center></h3>");
pw.close();
catch(Exception e)
System.out.println(e);
Can anyone look this code and help me out where i am doing the mistake.
Thanks. -
Insert date in dd-mmm-yyyy format
I have a jsp page, from that i can enter values in oracle database.
my jsp page is working, but the problem is that it can only accept the date
dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
my code is as bellow:
<html>
<body>
<table>
<tr>
<td>
<%@ page import =" java.sql.Date.*" %>
<%@ page import =" java.text.SimpleDateFormat.*" %>
<%@ page import =" java.util.Date.*" %>
<%@ page import =" java.text.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page language="java" import="java.sql.*" %>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
System.out.println("got connection");
%>
<%
char pay_post,pay_type;
String action = request.getParameter("action");
if (action != null && action.equals("save")) {
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
pstmt.setString(1,request.getParameter("vou_no"));
pstmt.setString(2,request.getParameter("pay_date"));
pstmt.setString(3,request.getParameter("pay_post"));
pstmt.setString(4,request.getParameter("pay_narr"));
pstmt.setString(5, request.getParameter("chq_no"));
pstmt.setString(6,request.getParameter("chq_date"));
pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
pstmt.setString(8,request.getParameter("pay_type"));
pstmt.executeUpdate();
conn.commit();
conn.setAutoCommit(true);
%>
<%
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery
("SELECT * FROM pay_header ");
%>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<th><input value="" name="vou_no" size="10"></th>
<th><input value="" name="pay_date" size="10"></th>
<th><input value="" name="pay_post" size="15"></th>
<th><input value="" name="pay_narr" size="15"></th>
<th><input value="" name="chq_no" size="15"></th>
<th><input value="" name="chq_date" size="15"></th>
<th><input value="" name="chq_amt" size="15"></th>]
<th><input value="" name="pay_type" size="15"></th>
<th><input type="submit" value="save"></th>
</form>
</tr>
<%
while ( rs.next() ) {
%>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
<td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
<td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
<td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
<td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
<td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
<td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
<td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
<td><input type="submit" value="save"></td>
</form>
</tr>
<%
%>
</table>
<%
// Close the ResultSet
rs.close();
// Close the Statement
statement.close();
// Close the Connection
conn.close();
} catch (SQLException sqle) {
out.println(sqle.getMessage());
} catch (Exception e) {
out.println(e.getMessage());
%>
</td>
</tr>
</body>
</html>thanx for u r help..
now i have used simple date format method and also apllied setDate() method.
bit its coming error NULL
code:
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
java.util.Date pay_date_temp = null;
java.util.Date pay_post_temp = null;
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
pstmt.setString(1,request.getParameter("vou_no"));
pstmt.setDate(2,pay_date);
pstmt.setString(3,request.getParameter("pay_post"));
pstmt.setString(4,request.getParameter("pay_narr"));
pstmt.setString(5, request.getParameter("chq_no"));
pstmt.setDate(6,chq_date);
pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
pstmt.setString(8,request.getParameter("pay_type"));
help me -
How to insert date in mmm/dd/yyyy format
hi all,
im getting date from user-interface in the format of mmm/dd/yyy.
when i tried to insert data in this format,
insert into temp values('10-july-2000);
insert into temp values('july-10-2000');
the first statement is working fine. and the second statement is givine msg,
SQL> insert into temp values('10-july-1999');
1 row created.
SQL> insert into temp values('july-10-1999');
insert into temp values('july-10-1999')
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected
how to get this.
regards
pavanI have read that ALTER SYSTEM changes will be effective immediately and there is no need to bounce the database.
right but if parameter is "modifiable" if not then we need to "restart database"
there three parameter with "alter system .... cmd"
1. Memory
2. Spfile ------------effect in next startup
3. Both ( Memory + spfile) Default
hope this helps
Let take example : PROCESSES is not modifiable parameter.
SQL> show parameter process
NAME TYPE VALUE
processes integer 150
SQL> alter system set processes = 152 scope=both
2 /
alter system set processes = 152 scope=both
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> alter system set processes = 152 scope=memory
2 /
alter system set processes = 152 scope=memory
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> alter system set processes = 152 scope=spfile;
System altered.
SQL> show parameter processes
NAME TYPE VALUE
processes integer 150
SQL> startup force
ORA-01031: insufficient privileges
SQL> conn sys as sysdba
Enter password:
Connected.
SQL> startup force
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145488364 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
Database mounted.
Database opened.
SQL>
SQL> show parameter processes
NAME TYPE VALUE
processes integer 152
SQL>Message was edited by:
user52 -
Inserting dates in mm/dd/yyyy format in excel sheet
I am reading data from sql server 2005 which returns dates in the yyyy/mm/dd format. Now I have to insert this data into an excel sheet and it is supposed to be in the mm/dd/yyyy format. I tried converting the date formats in java but when I insert the date as a String the program throws
java.sql.SQLException: [Microsoft][ODBC Excel Driver] Data type mismatch in criteria expression.
If I try to insert it as a java.util.Date or java.sql.Date it also includes the timestamp(which i do not want ) since thats the way MS SQL Server returns it in the result set.
Someone said using PreparedStatement would help. How?
Can someone please help me ?neoforu7 wrote:
I have to insert data into excel sheets that already have pre defined macroes that do some calculations and get the data in the format i want. I dont know if this is possible with POI or JExcel. You most definitely not are going to find that in ODBC. The excel odbc driver does very, very little.
[http://support.microsoft.com/kb/178717]
And I also dont have the time to learn these. So please help me if u canSorry - then you should just tell someone that it isn't going to happen.
Your requirements, excel and macros, is going to take a LOT of time.
At a minimum, without seeing the exact requirements and macros, myself I wouldn't start with less than three months of time. -
INSERT & UPDATE changing date format to mm/dd/yyyy!!!
I have INSERT & UPDATE ASP/VB forms which have a date
field which submits to
Access....except when the date is entered as dd/mm/yyyy, it
decides to
convert it to mm/dd/yyyy....absolutely terrific!! :o((
I've added this:
<% Session.LCID = 2057 %>
I've checked the date format, I've done absolutely everything
I can think
of, and can source on the newsgroups, but NOTHING.
What, on earth, is going on??????????????
If anyone can help save me from this madness, please tell me
why this is
happening?
I'm using ASP/VB, with Access on a Windows server and, up
until now, I've
never had this problem.
Here's my INSERT code:
<%@LANGUAGE="VBSCRIPT"%>
<% Session.LCID = 2057 %>
<!--#include file="../Connections/dsnNAME.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" &
Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_dsnNAME_STRING
MM_editCmd.CommandText = "INSERT INTO tblNews (newstitle,
newsdate,
newsenddate, thumbnail, largeimage, newstextsnip, newstext,
emailcontact,
urllink, [include]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param1", 202,
1, 75, Request.Form("newstitle")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param2", 135,
1, -1, MM_IIF(Request.Form("newsdate"),
Request.Form("newsdate"), null)) '
adDBTimeStamp
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param3", 135,
1, -1, MM_IIF(Request.Form("newsenddate"),
Request.Form("newsenddate"),
null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param4", 202,
1, 75, Request.Form("thumbnail")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param5", 202,
1, 75, Request.Form("largeimage")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param6", 203,
1, 536870910, Request.Form("newstextsnip")) ' adLongVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param7", 203,
1, 536870910, Request.Form("newstext")) ' adLongVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param8", 202,
1, 75, Request.Form("emailcontact")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param9", 202,
1, 75, Request.Form("urllink")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param10", 5,
1, -1, MM_IIF(Request.Form("include"), 1, 0)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "confirm.htm"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" &
Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" &
Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
Thanks.
Nath.Well, I've established that it's DW8.0.2 that is causing this
strange
occurence.
Reverted back to previously created versions of my
INSERT/UPDATE form pages
(created in DWMX) and it all works fine!!
I think that makes the whole situation even more frustrating
because I had
HUGE problems with this back in 2003/2004, and resolved it.
Now I've upgraded to DW8.0.2 and it's all gone "ape" again.
<sigh>
Any ideas, looking at the code in my initial post, why this
is happening?
For comparison here is the same INSERT created in DWMX that
WORKS:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/dsnNAME.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" &
Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_dsnNAME_STRING
MM_editTable = "tblNews"
MM_editRedirectUrl = "confirm.htm"
MM_fieldsStr =
"newstitle|value|newsenddate|value|thumbnail|value|largeimage|value|newstextsnip|value|ne wstext|value|emailcontact|value|urllink|value|include|value"
MM_columnsStr =
"newstitle|',none,''|newsenddate|',none,NULL|thumbnail|',none,''|largeimage|',none,''|new stextsnip|',none,''|newstext|',none,''|emailcontact|',none,''|urllink|',none,''|include|no ne,1,0"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString
<> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" &
Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" &
Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and
execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") &
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " ("
& MM_tableValues & ")
values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
This type of thing does my HEAD in.
Nath.
"tradmusic.com" <[email protected]> wrote in
message
news:[email protected]...
>I have INSERT & UPDATE ASP/VB forms which have a date
field which submits
>to Access....except when the date is entered as
dd/mm/yyyy, it decides to
>convert it to mm/dd/yyyy....absolutely terrific!! :o((
>
> I've added this:
> <% Session.LCID = 2057 %>
>
> I've checked the date format, I've done absolutely
everything I can think
> of, and can source on the newsgroups, but NOTHING.
> What, on earth, is going on??????????????
>
> If anyone can help save me from this madness, please
tell me why this is
> happening?
> I'm using ASP/VB, with Access on a Windows server and,
up until now, I've
> never had this problem.
>
> Here's my INSERT code:
>
> <%@LANGUAGE="VBSCRIPT"%>
> <% Session.LCID = 2057 %>
> <!--#include file="../Connections/dsnNAME.asp" -->
> <%
> Dim MM_editAction
> MM_editAction =
CStr(Request.ServerVariables("SCRIPT_NAME"))
> If (Request.QueryString <> "") Then
> MM_editAction = MM_editAction & "?" &
> Server.HTMLEncode(Request.QueryString)
> End If
>
> ' boolean to abort record edit
> Dim MM_abortEdit
> MM_abortEdit = false
> %>
> <%
> ' IIf implementation
> Function MM_IIf(condition, ifTrue, ifFalse)
> If condition = "" Then
> MM_IIf = ifFalse
> Else
> MM_IIf = ifTrue
> End If
> End Function
> %>
> <%
> If (CStr(Request("MM_insert")) = "form1") Then
> If (Not MM_abortEdit) Then
> ' execute the insert
> Dim MM_editCmd
>
> Set MM_editCmd = Server.CreateObject ("ADODB.Command")
> MM_editCmd.ActiveConnection = MM_dsnNAME_STRING
> MM_editCmd.CommandText = "INSERT INTO tblNews
(newstitle, newsdate,
> newsenddate, thumbnail, largeimage, newstextsnip,
newstext, emailcontact,
> urllink, [include]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
> MM_editCmd.Prepared = true
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param1", 202,
> 1, 75, Request.Form("newstitle")) ' adVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param2", 135,
> 1, -1, MM_IIF(Request.Form("newsdate"),
Request.Form("newsdate"), null)) '
> adDBTimeStamp
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param3", 135,
> 1, -1, MM_IIF(Request.Form("newsenddate"),
Request.Form("newsenddate"),
> null)) ' adDBTimeStamp
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param4", 202,
> 1, 75, Request.Form("thumbnail")) ' adVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param5", 202,
> 1, 75, Request.Form("largeimage")) ' adVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param6", 203,
> 1, 536870910, Request.Form("newstextsnip")) '
adLongVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param7", 203,
> 1, 536870910, Request.Form("newstext")) ' adLongVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param8", 202,
> 1, 75, Request.Form("emailcontact")) ' adVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param9", 202,
> 1, 75, Request.Form("urllink")) ' adVarWChar
> MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param10", 5,
> 1, -1, MM_IIF(Request.Form("include"), 1, 0)) ' adDouble
> MM_editCmd.Execute
> MM_editCmd.ActiveConnection.Close
>
> ' append the query string to the redirect URL
> Dim MM_editRedirectUrl
> MM_editRedirectUrl = "confirm.htm"
> If (Request.QueryString <> "") Then
> If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) =
0) Then
> MM_editRedirectUrl = MM_editRedirectUrl & "?" &
Request.QueryString
> Else
> MM_editRedirectUrl = MM_editRedirectUrl & "&"
& Request.QueryString
> End If
> End If
> Response.Redirect(MM_editRedirectUrl)
> End If
> End If
> %>
>
> Thanks.
> Nath.
> -
Hy,
I've got a problem when we insert a timestamp to a db.
When I try to start an insert code I get this error:
SQL-Error: ORA-01830: "data format picture ends before converting entire input string"
Insert into ABC_123("dtstamp") values (to_timestamp('31.05.13 09:30:05,000748000 +01:00','DD.MM.RR HH24:MI:SSXFF'));
with this language settings
National Language Support
National
Language Parameter
Value
NLS_CALENDAR
GREGORIAN
NLS_CHARACTERSET
WE8MSWIN1252
NLS_COMP
BINARY
NLS_CURRENCY
€
NLS_DATE_FORMAT
DD.MM.RR
NLS_DATE_LANGUAGE
GERMAN
NLS_DUAL_CURRENCY
€
NLS_ISO_CURRENCY
GERMANY
NLS_LANGUAGE
GERMAN
NLS_LENGTH_SEMANTICS
BYTE
NLS_NCHAR_CHARACTERSET
AL16UTF16
NLS_NCHAR_CONV_EXCP
FALSE
NLS_NUMERIC_CHARACTERS
NLS_SORT
GERMAN
NLS_TERRITORY
GERMANY
NLS_TIME_FORMAT
HH24:MI:SSXFF
NLS_TIMESTAMP_FORMAT
DD.MM.RR HH24:MI:SSXFF
NLS_TIMESTAMP_TZ_FORMAT
DD.MM.RR HH24:MI:SSXFF TZR
NLS_TIME_TZ_FORMAT
HH24:MI:SSXFF TZR
I didn't see the error. Maybe somebody can help me.
Thx
Felixef5fe917-5142-4425-a464-94ab111ed87a wrote:
Hy,
I've got a problem when we insert a timestamp to a db.
When I try to start an insert code I get this error:
SQL-Error: ORA-01830: "data format picture ends before converting entire input string"
Insert into ABC_123("dtstamp") values (to_timestamp('31.05.13 09:30:05,000748000 +01:00','DD.MM.RR HH24:MI:SSXFF'));
with this language settings
National Language Support
National
Language Parameter
Value
NLS_CALENDAR
GREGORIAN
NLS_CHARACTERSET
WE8MSWIN1252
NLS_COMP
BINARY
NLS_CURRENCY
€
NLS_DATE_FORMAT
DD.MM.RR
NLS_DATE_LANGUAGE
GERMAN
NLS_DUAL_CURRENCY
€
NLS_ISO_CURRENCY
GERMANY
NLS_LANGUAGE
GERMAN
NLS_LENGTH_SEMANTICS
BYTE
NLS_NCHAR_CHARACTERSET
AL16UTF16
NLS_NCHAR_CONV_EXCP
FALSE
NLS_NUMERIC_CHARACTERS
NLS_SORT
GERMAN
NLS_TERRITORY
GERMANY
NLS_TIME_FORMAT
HH24:MI:SSXFF
NLS_TIMESTAMP_FORMAT
DD.MM.RR HH24:MI:SSXFF
NLS_TIMESTAMP_TZ_FORMAT
DD.MM.RR HH24:MI:SSXFF TZR
NLS_TIME_TZ_FORMAT
HH24:MI:SSXFF TZR
I didn't see the error. Maybe somebody can help me.
Thx
Felix
Insert into ABC_123("dtstamp") values (to_timestamp('31.05.13 09:30:05,000748000 +01:00','DD.MM.RR HH24:MI:SSXFF'));
| | | | | | |
| | | | | | +--????
| | | | | +----SS
| | | | |
| | | | +-----MI
| | | |
| | | +-----HH24
| | |
| | +----RR
| |
| +----MM
|
+----DD
The error message means exactly what it says. Your data format string doesn't account for everything in your data string. -
Insert record wizard date format
Hi,
How can i change the default insert from mm/dd/yyyy to uk format dd/mm/yyyy
currently if i insert 08/05/2010 which is the 8th may 2010 in uk it will put it into database as 2010/08/05 which when i retrieve is the 5th august 2010 in uk.
is there a config folder anywhere i can change this?
many thanksthanks bregent.
it is php/mysql
not sure what that other reply is about after yours but thanks for your advice.
is there no way in dreamweaver to change the preferences like in addt to a specific date format?
thanks
Date: Wed, 19 May 2010 12:25:47 -0600
From: [email protected]
To:
Subject: Dreamweaver Application Development Insert record wizard date format
You didn't mention what DBMS or scripting language you are using.
The best way to get dates from a user is to supply 3 fields for input; day, month, year - then assemble them into the string format that the DBMS is expecting.
> -
Insert DATA in my DB on uppercase format
I have a datablock based , I used commit_form(); to insert data in my DB .
But,I want to insert data into my DB on uppercase format!!
Any suggestions ?Hi.
You have many options. Which one to choose depends on your requirements. If you want the user to input in uppercase in the form's text items then just set the property "Case Restriction" of that text item to "Upper". This way you have a consistent data between form and database, so no other action is required. If you do not mind the case restriction by user input then you could do it in database trigger. But be aware querying such data could be tricky as you have to take it into account querying is case sensitive by default.
Best regards. -
How to change date format for xml insert to a view
We want to accept more than one data format in an XML insert using DBMS_XMLSave.insertXML(insCtx,xmlDoc);
The two formats are
6/7/2004 10:47:21 - This is working
2004-06-08-04:00 - This gives the error
java.text.ParseException: Unparseable date: "2004-06-08-04:00"'Make the column datatype VARCHAR2
Maybe you are looking for
-
MacBook Pro 2009 Model Identifier: MacBookPro5,1 Processor 2.4 GHz Intel Core 2 Duo Memory 4 GB 1067 MHz DDR3 Software OS X 10.8.5 (12F45) Iphoto '11 Iphoto on my macbook pro has stopped working. It comes up with a message saying that the library
-
Is it possible to add name to subject line when submitting a pdf form
Hi, I have created a form with Live Cycle and added a button which submittingthe form as PDF. I was wondering is it possible to add staff name to the subject line just after Leave Request as seen in the picture below? Regards
-
I have an M-audio firewire 410 audio interface hooked up to 6 speakers, and it works great with my FCP and iTunes. Then I go to Logic, and go to Preferences, Audio, Drivers, and set it to the firewire 410 multi-channel selection. When I go to my time
-
Is there a way to find all the locked files my computer?
I am having trouble importing some files into Aperture and I discovered that one of the reasons might be that some of the files are locked. I know how to unlock them but I'd like to find the locked files and unlock them all at once. Is there a way to
-
Creative cloud photoshop update fails repeatedly.
I just installed Photoshop CC after purchasing CC for Photographers. After installing, the desktop app indicated an update for photoshop. Update and Retry failed. Message reads Retry or contact customer support (49). Can't launch application. Please