Rajesh B

Rajesh B

  • NA
  • 38
  • 10.2k

how to use the TO_DATE Function for more date inputs.

Aug 5 2013 3:21 AM
i have writing a query to connect oracle db with asp.net, and i have created a webpage and then i kept 3 textboxes, and two buttons for getting input and o/p, in textboxes i have to give the date and in oracle db i have created column for those dates, am using to_date function, but i dont know how to write the to_date for continuesly, its says some syntax error. so can you please tell me how to use the to_date function for continuesly and next to some uppended textboxes, i ll mention the code below for ur reference.


string
oocdate = txtoocaccpteddate.Text;
string filingdate = txtfillingdate.Text;
string fieldautorities = txtfieldwithauth.Text;
string receipt = txtreceiptdate.Text;
string approved = txtapproveddate.Text;
string appvalidfrom = txtapplicationvalidfrom.Text;
string appvalidto = txtapplicationvalidto.Text;

string sql = "insert into tmp (REC_KEY, APPL_NO, EMP_NO, CASE_VISA_TYPE_CODE, CASE_VISA_SUBTYPE_CODE, OOC_ACCEPTED_DATE, FILING_SENT_DATE, FILED_WITH_AUTHORITIES, RECEIPT_DATE, APPROVED_DATE, APPL_VALID_FROM, APPL_VALID_TO) values ('" + txtreckey.Text + "','" + txtrefappno.Text + "','" + txtempid.Text + "','" + txtcasevisatype.Text + "','" + txtcasevisatypecode.Text + "','(TO_DATE('" + oocdate + "','DD-MM-YY HH:MI A.M.'))','(TO_DATE('" + filingdate + "','DD-MM-YY HH:MI A.M.'))','(TO_DATE('" + fieldautorities + "','DD-MM-YY HH:MI A.M.'))','" + txtreceiptno.Text + "','(TO_DATE('" + receipt + "','DD-MM-YY HH:MI A.M.'))','(TO_DATE('" + approved + "','DD-MM-YY HH:MI A.M.'))','(TO_DATE('" + appvalidfrom + "','DD-MM-YY HH:MI A.M.'))','(TO_DATE('" + appvalidto + "','DD-MM-YY HH:MI A.M.'))";

// here i have diclared the textboxes as some var name and i have appending them in to_date functions. here first two columns are varchar type, like rec_key and emp id, case visa type, case visa subtype, these things are varchar and other than this everything is date. i dont knnow the syntax for continuesly using to_date function.

Answers (4)