Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error in updating date

Error in updating date

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netalgorithmstoolshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    n_gchaitra
    wrote on last edited by
    #1

    I have the following function writen in asp.net with vb script. when click the update button everthing is getting updated except "date" I tried to update using date.parse also but no use. The same code was woking fine previous say a week back. I have not made any changes also. But I am not finding any reasons for this. this is happening whereever i have used date. Insertion or updation of date and searching based on date is not working. Function update() Dim flag As Boolean flag = False Dim tran As SqlClient.SqlTransaction Dim a As String a = txtexpdate.text Dim d As Date = Date.parse(a) If txtremark.Text.Trim = "" Or lblcustname.Text.Trim = "" Or txtcustdrno.Text.Trim = "" Or txtbore.Text.Trim = "" Or txtstroke.Text.Trim = "" Or txtapplication.Text.Trim = "" Or txtrod.Text.Trim = "" Or txtpress.Text.Trim = "" Or txteqpmodel.Text.Trim = "" Then lblstatus.Visible = True lblstatus.ForeColor = Color.Red lblstatus.Text = "Fields can not be left blank !" Exit Function ElseIf IsNumeric(txtbore.Text.Trim) = False Or IsNumeric(txtstroke.Text.Trim) = False Or IsNumeric(txtrod.Text.Trim) = False Or IsNumeric(txtpress.Text.Trim) = False Then lblstatus.Visible = True lblstatus.ForeColor = Color.Red lblstatus.Text = "Bore,stroke,rod and working pressure should have numeric value !" Exit Function Else If dbconn.State <> ConnectionState.Open Then dbconn.Open() End If Dim comm As New SqlCommand() comm = dbconn.CreateCommand tran = dbconn.BeginTransaction comm.Transaction = tran Try comm.CommandText = "update D_proposal set cust_drw_no='" & txtcustdrno.Text.Trim & "',cust_name='" & lblcustname.Text.Trim & "',typ_cyl='" & txttypcyl.Text.Trim & "',cushioning='" & txtcush.Text.Trim & "',bore='" & txtbore.Text.Trim & "',stroke='" & txtstroke.Text.Trim & "',application='" & txtapplication.Text.Trim & "',category='" & txtcat.Text.Trim & "',sada='" & txtsada.Text.Trim & "',rod='" & txtrod.Text.Trim & "',wrk_press='" & txtpress.Text.Trim & "',eqp_mdl='" & txteqpmodel.Text.Trim & "',mounting='" & txtmounting.Text.Trim & "'where pno='" & lblpno.Text.Trim & "'" comm.ExecuteNonQuery() 'comm.CommandText = "update D_task_det set associate='" & txtassociate.Text.Trim

    N 1 Reply Last reply
    0
    • N n_gchaitra

      I have the following function writen in asp.net with vb script. when click the update button everthing is getting updated except "date" I tried to update using date.parse also but no use. The same code was woking fine previous say a week back. I have not made any changes also. But I am not finding any reasons for this. this is happening whereever i have used date. Insertion or updation of date and searching based on date is not working. Function update() Dim flag As Boolean flag = False Dim tran As SqlClient.SqlTransaction Dim a As String a = txtexpdate.text Dim d As Date = Date.parse(a) If txtremark.Text.Trim = "" Or lblcustname.Text.Trim = "" Or txtcustdrno.Text.Trim = "" Or txtbore.Text.Trim = "" Or txtstroke.Text.Trim = "" Or txtapplication.Text.Trim = "" Or txtrod.Text.Trim = "" Or txtpress.Text.Trim = "" Or txteqpmodel.Text.Trim = "" Then lblstatus.Visible = True lblstatus.ForeColor = Color.Red lblstatus.Text = "Fields can not be left blank !" Exit Function ElseIf IsNumeric(txtbore.Text.Trim) = False Or IsNumeric(txtstroke.Text.Trim) = False Or IsNumeric(txtrod.Text.Trim) = False Or IsNumeric(txtpress.Text.Trim) = False Then lblstatus.Visible = True lblstatus.ForeColor = Color.Red lblstatus.Text = "Bore,stroke,rod and working pressure should have numeric value !" Exit Function Else If dbconn.State <> ConnectionState.Open Then dbconn.Open() End If Dim comm As New SqlCommand() comm = dbconn.CreateCommand tran = dbconn.BeginTransaction comm.Transaction = tran Try comm.CommandText = "update D_proposal set cust_drw_no='" & txtcustdrno.Text.Trim & "',cust_name='" & lblcustname.Text.Trim & "',typ_cyl='" & txttypcyl.Text.Trim & "',cushioning='" & txtcush.Text.Trim & "',bore='" & txtbore.Text.Trim & "',stroke='" & txtstroke.Text.Trim & "',application='" & txtapplication.Text.Trim & "',category='" & txtcat.Text.Trim & "',sada='" & txtsada.Text.Trim & "',rod='" & txtrod.Text.Trim & "',wrk_press='" & txtpress.Text.Trim & "',eqp_mdl='" & txteqpmodel.Text.Trim & "',mounting='" & txtmounting.Text.Trim & "'where pno='" & lblpno.Text.Trim & "'" comm.ExecuteNonQuery() 'comm.CommandText = "update D_task_det set associate='" & txtassociate.Text.Trim

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      What is your date column datatype in Database ? Have you tried running the same query in query analyzer ? If so what error you got ?


      My Website | Ask smart questions

      N 1 Reply Last reply
      0
      • N N a v a n e e t h

        What is your date column datatype in Database ? Have you tried running the same query in query analyzer ? If so what error you got ?


        My Website | Ask smart questions

        N Offline
        N Offline
        n_gchaitra
        wrote on last edited by
        #3

        Now it is working. I have changed the enableviewstate property of all the controls to true and readonly property of datetextbox(text boxes where we have date value) to false. But i want datextbox readonly. What can I do for this?

        Chaitra N

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups