Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net oracle database 3 tier cannot convert string to datetime
    primarykey
    data
    text
    <p>I'm working in Asp.net C# 3 tier with oracle database. I create a function for Read and Delete and it is working but for the insert and update I’m getting error of converting string to datetime.</p> <p>Here is the Business layer code:</p> <pre><code> public void InsertSurvey(string SURV_NAME, DateTime SURV_STARTDATE, DateTime S_ENDDATE) { try { string str = "select max(SURV_ID) as max_SURV_ID from SURVEY"; int maxVal = (_dbAccess.returnint32(str)); string SURV_ID = Convert.ToString(maxVal); if (string.IsNullOrEmpty(SURV_ID)) { maxVal = 1; } else { maxVal++; } string strInsert = "SET IDENTITY_INSERT SURVEY ON insert into SURVEY(SURV_ID,SURV_NAME,SURV_STARTDATE,S_ENDDATE) values('" + maxVal + "','" + SURV_NAME + "','" + SURV_STARTDATE + "','" + S_ENDDATE + "') SET IDENTITY_INSERT SURVEY OFF"; _dbAccess.executeQuery(strInsert); } catch (Exception ex) { throw ex; } } </code></pre> <p>And here is the Submit code from the page code behind for the insert form:</p> <pre><code> public partial class Survey_insert_survey : System.Web.UI.Page { BusSurvey _objSurvey = new BusSurvey(); protected void btnSubmit_Click(object sender, EventArgs e) { _objSurvey.InsertSurvey(txtSURV_NAME.Text, txtSURV_STARTDATE.Text, txtS_ENDDATE.Text); //If records successfully entered then redirect to feedback page Response.Redirect("view-survey.aspx"); } } </code></pre> <p>This the error Im getteing:</p> <p><img src="https://i.stack.imgur.com/NSevW.png" alt="enter image description here"></p> <p>Hope I get help </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload