|
 |
access_asp thread: >>>>Inserting date value into database<<<<
Message #1 by joyce@j... on Wed, 12 Mar 2003 18:55:26
|
|
Could anyone please help me with this? I am trying to insert a date value
into my database.
In my code there is a line:
Request("payment_date")
And I am trying to insert that value into my database, the code is
something like this:
strSQL="INSERT INTO Sold (SoldDate) VALUES ( #" & payment_date & "#)"
But I kept getting errors.
I have tried to switch the #" & payment_date & "# to
#' & payment_date & '#
"# & payment_date #"
'" & payment_date "'
'# & payment_date #'
'"# & payment_date #"'
But they all don't work, either I get a datatype mismatch error or
expected end error.
I am pretty sure the error is at #" & payment_date & "#, but just don't
know how to fix it. Please advice.
Thanks in advance.
Message #2 by Karri Peterson <KPeterson@C...> on Wed, 12 Mar 2003 12:38:46 -0600
|
|
I know this is a stupid answer, but have you double checked the kind of
value the database is looking for--? Sometimes, if you are working in a
multi-developer environment, even tho logically you would use a date here,
sometimes another developer will use like an string or character type and it
can mess you up.
-----Original Message-----
From: joyce@j... [mailto:joyce@j...]
Sent: Wednesday, March 12, 2003 12:55 PM
To: Access ASP
Subject: [access_asp] >>>>Inserting date value into database<<<<
Could anyone please help me with this? I am trying to insert a date value
into my database.
In my code there is a line:
Request("payment_date")
And I am trying to insert that value into my database, the code is
something like this:
strSQL="INSERT INTO Sold (SoldDate) VALUES ( #" & payment_date & "#)"
But I kept getting errors.
I have tried to switch the #" & payment_date & "# to
#' & payment_date & '#
"# & payment_date #"
'" & payment_date "'
'# & payment_date #'
'"# & payment_date #"'
But they all don't work, either I get a datatype mismatch error or
expected end error.
I am pretty sure the error is at #" & payment_date & "#, but just don't
know how to fix it. Please advice.
Thanks in advance.
Message #3 by "Ken Schaefer" <ken@a...> on Thu, 13 Mar 2003 12:45:53 +1100
|
|
I suggest you put something into your code that looks like this:
<%
Dim payment_date
payment_date = Request("payment_date")
If isDate(payment_date) then
Response.Write("valid date")
Else
Response.Write("not a valid date")
End If
Response.End
%>
If that doesn't help, please post the *exact* error message you are
receiving.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <joyce@j...>
Subject: [access_asp] >>>>Inserting date value into database<<<<
: Could anyone please help me with this? I am trying to insert a date value
: into my database.
:
: In my code there is a line:
:
: Request("payment_date")
:
: And I am trying to insert that value into my database, the code is
: something like this:
:
: strSQL="INSERT INTO Sold (SoldDate) VALUES ( #" & payment_date & "#)"
:
: But I kept getting errors.
:
: I have tried to switch the #" & payment_date & "# to
:
: #' & payment_date & '#
:
: "# & payment_date #"
:
: '" & payment_date "'
:
: '# & payment_date #'
:
: '"# & payment_date #"'
:
: But they all don't work, either I get a datatype mismatch error or
: expected end error.
:
: I am pretty sure the error is at #" & payment_date & "#, but just don't
: know how to fix it. Please advice.
:
: Thanks in advance.
|
|
 |