locked
to_date function in c# query RRS feed

  • Question

  • User-1600078915 posted

    I am writing a query to connect oracle db with asp.net, and i have created a webpage and then i kept 6 textboxes, and two buttons for getting input and o/p, on the button click i kept all the thigns, to insert data into db using text boxes. and 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 continuesly and next to some appended textboxes, herewith i have written the example query now which i have written and getting error.


    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.

    Monday, August 5, 2013 3:38 AM

Answers