473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can I insert date into oracle using addnew and update?

101 100+
I like to use this method when inserting into a database:

Expand|Select|Wrap|Line Numbers
  1. Set Insert = Server.CreateObject("ADODB.Recordset")
  2. Insert.Open "test", objConn, 1, 3, 2
  3. Insert.AddNew
  4. Insert("FIRSTNAME") = "Joe"
  5. Insert("LASTNAME") = "bob"
  6. Insert("DATE_BORN") = "10/10/80"
  7. Insert.Update
  8. Insert.Close
  9. t RSInsert = nothing
However, I don't know how to insert the date, seeing that it's an oracle database. I know it's looking for a specific date object. Does one exist in asp that is compatible with oracle?

The error message is this:

Expand|Select|Wrap|Line Numbers
  1. Provider error '80020005'
  2.  
  3. Type mismatch.
  4.  
  5. /<asp_script>.asp, line <line_#>
Thanks for any help
May 30 '08 #1
5 5062
idsanjeev
241 100+
Hi zensunni
you should use vbscript function for data type conversion
w3schools
Try to insert date with

Expand|Select|Wrap|Line Numbers
  1. Insert("DATE_BORN") = cdate("10/10/80")
  2.  
Jun 2 '08 #2
DrBunchman
979 Expert 512MB
I've not tried this but what would happen if you were to wrap the Oracle date function to_date around the date you're trying to insert?

Dr B
Jun 2 '08 #3
zensunni
101 100+
Ha, DrBunch,

I've tried this with no avail. This is why I went with the assumption that the record set is looking for an actual date object. But just to make sure we're talking about the same thing, this is what I did:

Insert("DATEBORN") = "TO_DATE('11/11/08', 'mm/dd/08')"
Jun 3 '08 #4
vikas251074
198 100+
Hello

Try using
Insert("DATE_BORN") = to_date("10/10/80",'mm/dd/yy')

Thanks and regards,
Vikas
Jun 4 '08 #5
idsanjeev
241 100+
after testing my code thats was posted is work fine please try to test this code without insert into table just print it
Expand|Select|Wrap|Line Numbers
  1. <%date1="11/10/80"
  2. response.Write(cdate(date1))
  3. response.Write(formatdatetime(date1,1))
  4. %>
I think oracle date function to_date is only work with oracle insert statements
regards
Jha
Jun 4 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: James Goodman | last post by:
I have an asp page which the user enters a time(e.g. 12:21). I need to insert this time into a SQL Server DB, which has a smalldatetime column. I have tried everything I can think of (such as...
2
by: Jan van Veldhuizen | last post by:
I try to use the Server Data on Insert property to return a column value swhich is set in a trigger. But it does not work. Why not? What am I doing wrong? (BTW I'm using Oracle version 10) My...
4
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
5
by: robecflo | last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm developing with windows forms and vb.net, and oracle as a database. At this moment i have a table called amortizaciones, this table...
2
by: pillmill | last post by:
I replaced AddNew statments with INSERT INTO, but am unable to write to the same tables. Foreign keys violations are the main errors. Why are these occuring ? Before: set rs3=...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
8
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table...
0
by: patogenic | last post by:
I want to use the grid for record insertion. Everything works fine except after saving the new record; all controls for record insertion are still visible besides the "Add New" button. I think...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
1
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...
0
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...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.