|
-
Apr 9th, 2007, 05:46 AM
#1
Thread Starter
Addicted Member
inserting records in the oracle table problem
hi to all,
i am inserting the record in the table using C#.Net. my query is like that
string query =insert into TESTTABLE1 values('mmmm',25,'[email protected]','9894899987', '8-apr-2007');
when i am using the same query in the command prompt , record was inserted without any error.But when i am inserting the same query using the c#.Net , record was inserted with wrong date('20-apr-08'). plz some body help me to solve the problem.
thank u.
with thanks and regards
mmary
Last edited by mmary; Apr 9th, 2007 at 05:56 AM.
-
Apr 9th, 2007, 05:51 AM
#2
Registered User
Re: inserting records in the oracle table problem
This query is wrong, you use the following query it will work
vb Code:
string query=insert into testtable1(name,age,emailid,mobile,date) value ('mary',25,' [email protected]','9884809887','8-apr-2007');
-
Apr 9th, 2007, 06:31 AM
#3
Thread Starter
Addicted Member
Re: inserting records in the oracle table problem
thank u for ur reply. but it also giving the same problem. plz somebody help me to solve the problem.
thank u.
with thanks and regards
mmary
-
Apr 9th, 2007, 06:47 AM
#4
Registered User
Re: inserting records in the oracle table problem
vb Code:
//Surely this code will work, try this code
SqlConnection con = new SqlConnection("type your connection string");
con.Open();
string qry="insert into tablename(name,age,mobile) values('ravi',25,1234454)";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
Please rate if this code is work
-
Apr 9th, 2007, 08:45 AM
#5
Re: inserting records in the oracle table problem
If Oracle is anything like SQL Server then you should ALWAYS use the format #M/dd/yyyy# for your dates, so try #4/08/2007# as the date literal.
-
Apr 9th, 2007, 08:52 AM
#6
Re: inserting records in the oracle table problem
Oracle is not like SQL Server for Dates. Oracle expects all Dates to be in the form 'dd-Mon-YY' If any other format is sent you must specify that format in a To_Date Function
Code:
To_Date('4/9/2007','mm/dd/yyyy')
That would be today.
Do the default Oracle expects for today would be '9-Apr-07' (ensure inclued in single qoutes).
What is the error code (the error returned by Oracle Provider)?
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
May 18th, 2007, 01:07 AM
#7
Thread Starter
Addicted Member
Re: inserting records in the oracle table problem
thank u . thank u very much for ur kind reply. its working fine. thank u very much.
with thanks and regards
mmary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|