473,387 Members | 1,579 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,387 software developers and data experts.

Unable to insert a date to Oracle from ASP.NET

When i try to insert a date field to Oracle DB through INSERT command, i am getting an error "Invalid Month". I am using ASP.NET 2 (VB). Please advise how to tackle this issue.
May 9 '07 #1
3 3974
When i try to insert a date field to Oracle DB through INSERT command, i am getting an error "Invalid Month". I am using ASP.NET 2 (VB). Please advise how to tackle this issue.

Actually in oracle db, we can't change the date format internally. so, check whether the inserting date is in the oracle standard format or not and try. if it was not in the oracle's format, convert the date into the oracle's format and try.
May 9 '07 #2
yes i found that the dates from ASP page is in MM/DD/YYYY format and the Oracle format is DD/Mon/YYYY. Please advise how to format a date to that style, since FormatDateTime() dont have a format string to mention.
May 9 '07 #3
yes i found that the dates from ASP page is in MM/DD/YYYY format and the Oracle format is DD/Mon/YYYY. Please advise how to format a date to that style, since FormatDateTime() dont have a format string to mention.

Try something like this out:

Expand|Select|Wrap|Line Numbers
  1. dim Curdate
  2. Curdate = now()Text
  3.  
  4. ssqlCheckBox = "INSERT INTO Survey_User_Answer(Survey_Id,Question_Id,Answer_Id,Date_Answer,User_ID) VALUES (" & SurveyID & ",'" & objRS("Question_Id") & "' , '" & answerChoices(answerChoice) & "' , to_date('"&Curdate&"','dd--mm-yyyy hh12:mi:ss AM'), 'user')"
  5.  
  6. or
  7.  
  8. ssqlCheckBox = "INSERT INTO Survey_User_Answer(Survey_Id,Question_Id,Answer_Id,Date_Answer,User_ID) VALUES (" & SurveyID & ",'" & objRS("Question_Id") & "' , '" & answerChoices(answerChoice) & "' , to_date('"&Curdate&"','dd--mm-yyyy hh24:mi:ss'), 'user')"
May 9 '07 #4

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

Similar topics

7
by: Arek | last post by:
Hey, I am inserting values in the table: Dim sqlcomm1 As SqlCommand = New SqlCommand("INSERT INTO tblTasks (idTask, outdate) VALUES ('" & IDTask.text & "','" & txtOutdate.Text & "')", conn)...
1
by: SSG | last post by:
How to insert date to the sql server database. I am getting input from the HTML form and store it to database using ASP. how to store date field, what datatype needed and what conversion...
1
by: nihilks | last post by:
i use ADO in VB6 to connect to my Oracle database i made aconnection object 'con' and opened the database using it when i executed the statement con.Execute "insert into employee(no,,join_date)...
0
by: sourabhmca | last post by:
hi friend, I am want to insert date with time into sql server2000 using JSP.I hv 3 combo box for dd mm yyyy and 2 text box for hh and min ? and my table field type is smalldatetime.after that i ...
1
by: yzlin04 | last post by:
Does anyone know how to insert date into vb.net datagrid by using INSERT INTO command? From the code below, the error message is in cmd.ExecuteNonQuery() line. Here is the error message: An...
0
by: kishorys | last post by:
I have python version 2.5.1 and cx_Oracle version 4.3.1. Oracle is also in running state. I am getting an error while trying to connect to Oracle DB which is installed in my system from python. ...
0
by: raoofahmedkhan | last post by:
Hi All, I am trying to develop an application in vb.net in which i need to insert date in oracle database, my application is in vb.net. i am getting some problem while inserting date. Does...
5
by: zensunni | last post by:
I like to use this method when inserting into a database: Set Insert = Server.CreateObject("ADODB.Recordset") Insert.Open "test", objConn, 1, 3, 2 Insert.AddNew Insert("FIRSTNAME") = "Joe"...
2
by: ankitjain100 | last post by:
Hello Guys, This is my first question on this platform. I want to ask that How to insert Date in MY SQL in the MM-DD-YY format i am using JSP as my frontend. Please tell me , i will be very...
0
by: suvarn sawant | last post by:
I have written jsp code to insert date in oracle but its giving error null.my code is: String query="insert into test_KMS_DATA_ROW...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
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...

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.