Hey there. I have a problem whit some date insert.
I Have 3 dropdownlists and i want the code to get the values and insert them in the database,
the code looks like this:
yyyy = Request.Form("yyyy")
mm = Request.Form("mm")
dd = Request.Form("dd")
strborn = DateSerial(yyyy,mm,dd)
Its insert everything but not the date. only get 0000:00:00.
the Datatype is set to DATETIME and its NULL
Go crazy,, need help =)
7 3023
The date format in MySQL is YYYY-MM-DD.
Are you sure you have your 'date-to-be-inserted' in that format?
Otherwise show some of the code.
Ronald
"date-to-be-inserted" Hmm dont understand =). I know that the date format is YYYY-MM-DD.
What code do you want to see ? The insert code? If it so here it is: -
objconn.execute("INSERT into konton (anvnamn, losen, epost, fornamn, efternamn, personnf, personns, hur, reggad, kon) Values ('"&request.form("anv")&"', '"&request.form("losen")&"', '"&request.form("epost")&"', '"&request.form("fornamn")&"', '"&request.form("efternamn")&"', "&strborn&", '"&request.form("perns")&"', '"&request.form("Hur")&"', CURRENT_TIMESTAMP(), '"&request.form("kon")&"')")
-
use single quotes around the value - objconn.execute("INSERT into konton (anvnamn, losen, epost, fornamn, efternamn, personnf, personns, hur, reggad, kon) Values ('"&request.form("anv")&"', '"&request.form("losen")&"', '"&request.form("epost")&"', '"&request.form("fornamn")&"', '"&request.form("efternamn")&"', '"&strborn&"', '"&request.form("perns")&"', '"&request.form("Hur")&"', CURRENT_TIMESTAMP(), '"&request.form("kon")&"')")
When i do so i get:
[MySQL][ODBC 3.51 Driver][mysqld-5.0.51a-community-nt]Incorrect datetime value: '1/1/1960' for column 'personnf' at row 1
You can see that the date is in wrong order but in the code right.
How do i fix this? if i fix it in right order do you think it will work.
Please guys really need help with this.. This is the last thing thats not working.
I did get it to work with this:
strborn = ""&request.form("yyyy")&"-"&request.form("mm")&"-"&request.form("dd")&""
Thanks for sharing your solution with our members.
See you next time.
Ronald
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil Powell |
last post by:
I have a mySQL database table with a column field datatype of datetime that
I set up in the original create table statement like this:
create table nnet_usermetadata (
....
nnet_record_entered...
|
by: M. Bader |
last post by:
Hi,
i'm struggling with updating session expire times in my login table.
Can you tell me, how to correctly add an amount of seconds (after that
the session expires) to a datetime field?
...
|
by: David |
last post by:
Hi,
I have a field in a table called 'ShipDate'.
This particular field has allow null set to no. So by default this
sets all the records to show 00/00/0000 in the field for each record
that has...
|
by: gondor |
last post by:
hi!
i have a problem with a update-query:
start-structur (column 1 index, 2 datetime, 3 time of measurement, 4-6 values):
1 | 0000-00-00 00:00:00 | 0 | 21 | 22 | 23
2 | 0000-00-00 00:00:00...
|
by: Kenneth P |
last post by:
Hi,
I'm trying to use MySql 4.1 db instead of MSSql2k and am having problems
with the DateTime in the db.
In mysqladmtools 1.0.19 I'm recommended to use 0000-00-00 00:00:00 as the
default...
|
by: Emi Lu |
last post by:
Hello all,
I have a question about "date" & "timestamp" types in PostgreSQL. I want
to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for
them. However, it seems that PostgreSQL...
|
by: Rithish |
last post by:
Hello. I noticed a strange thing while using strtotime() and date()
functions in combination to generate from MySQL into a readable format.
By default, the MySQL date field will be 0000-00-00...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |