473,569 Members | 2,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to insert a date to Oracle from ASP.NET

3 New Member
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 3990
surendranathbenergi
1 New Member
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
raveesh
3 New Member
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
gill1978
19 New Member
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
2436
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) sqlcomm1.ExecuteNonQuery() Query is working fine if there is value in the txtOutDate, but if user leaves the field txtOutdate empty, system insert...
1
10387
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 needed. Thanx & Regards, SSG
1
8034
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) values(424,'12-SEP-2004')" i found that he new record was inserted into the database(i checked it using sql*plus) . But when retrieved through vb...
0
1618
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 want compare 2 date and want time in hh and min and display diff time and both date on sql server ? plz help soon?
1
2133
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 unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll Dim today As Date today = Date.Today
0
3959
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. >>> import cx_Oracle >>> cx_Oracle.Connection('scott/tiger@orcl') Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> ...
0
1407
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 anybody know how to get it done. Any help would be appreciated. Regards.
5
5106
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" Insert("LASTNAME") = "bob" Insert("DATE_BORN") = "10/10/80" Insert.Update Insert.Close
2
2025
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 thankful you all. Ankit
0
1951
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 values('"+rocode+"','"+roname+"',"+activityId+",'"+activity+"',"+duration+",to_date("+startdate+",MM/DD/YYYY HH24:MI:SS),'"+starttime+"',to_date("+enddate+",MM/DD/YYYY...
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.