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. Database & SysAdmin
  3. Database
  4. unhandled exception

unhandled exception

Scheduled Pinned Locked Moved Database
helpdatabasequestion
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.
  • S Offline
    S Offline
    Sudee
    wrote on last edited by
    #1

    hi all, I am getting following error.. An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll. There is no problem with my store procedure as I checked from Query Analyzer. public static void EditTreatInstrument(int Id,string Name,string BarCode,string PDACode,DateTime ExpireTime, int Method ) { SqlCommand cmd = WesServer.GetSqlCommand.Get( Conn , CommandType.StoredProcedure , "pr_EditTreatInstrument" ); cmd.Parameters.Add( GetSqlParameter.Get( "@intId", SqlDbType.Int, Id ) ); cmd.Parameters.Add( GetSqlParameter.Get( "@nvchrName", SqlDbType.NVarChar, Name ) ); cmd.Parameters.Add( GetSqlParameter.Get( "@vchrBarCode", SqlDbType.VarChar, BarCode ) ); cmd.Parameters.Add( GetSqlParameter.Get( "@vchrPDACode", SqlDbType.VarChar, PDACode ) ); cmd.Parameters.Add( GetSqlParameter.Get(" @dtExpireDate", SqlDbType.DateTime, ExpireTime )); cmd.Parameters.Add( GetSqlParameter.Get( "@intMethod", SqlDbType.Int, Method ) ); cmd.ExecuteNonQuery(); } What are the condition when such error can occer ??? Thanks, Sudeep ====== You need a head to program. Cool, fast and sharp.

    C 1 Reply Last reply
    0
    • S Sudee

      hi all, I am getting following error.. An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll. There is no problem with my store procedure as I checked from Query Analyzer. public static void EditTreatInstrument(int Id,string Name,string BarCode,string PDACode,DateTime ExpireTime, int Method ) { SqlCommand cmd = WesServer.GetSqlCommand.Get( Conn , CommandType.StoredProcedure , "pr_EditTreatInstrument" ); cmd.Parameters.Add( GetSqlParameter.Get( "@intId", SqlDbType.Int, Id ) ); cmd.Parameters.Add( GetSqlParameter.Get( "@nvchrName", SqlDbType.NVarChar, Name ) ); cmd.Parameters.Add( GetSqlParameter.Get( "@vchrBarCode", SqlDbType.VarChar, BarCode ) ); cmd.Parameters.Add( GetSqlParameter.Get( "@vchrPDACode", SqlDbType.VarChar, PDACode ) ); cmd.Parameters.Add( GetSqlParameter.Get(" @dtExpireDate", SqlDbType.DateTime, ExpireTime )); cmd.Parameters.Add( GetSqlParameter.Get( "@intMethod", SqlDbType.Int, Method ) ); cmd.ExecuteNonQuery(); } What are the condition when such error can occer ??? Thanks, Sudeep ====== You need a head to program. Cool, fast and sharp.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      The SqlException object will contain more information. The Message property and, if multiple error occurred, the Errors property will give lots of good information. If you cannot see from the exception message then post back to the forum and I'm sure someone will know. Good luck!


      "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!

      S 1 Reply Last reply
      0
      • C Colin Angus Mackay

        The SqlException object will contain more information. The Message property and, if multiple error occurred, the Errors property will give lots of good information. If you cannot see from the exception message then post back to the forum and I'm sure someone will know. Good luck!


        "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!

        S Offline
        S Offline
        Sudee
        wrote on last edited by
        #3

        After doing try catch within the error block I caught such exception: System.Data.SqlClient.SqlException: @dtExpireDate is not a parameter for procedure pr_EditTreatInstrument. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at.... so on and when I excluded @dtExpireDate, then I see exception like System.Data.SqlClient.SqlException: Procedure 'pr_EditTreatInstrument' excepts parameter '@dtExpireDate', which was not supplied. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at... so on Thank you, Sudee ====== You need a head to program. Cool, fast and sharp.

        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