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. Try Catch

Try Catch

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
1 Posts 1 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.
  • K Offline
    K Offline
    kris_viswa
    wrote on last edited by
    #1

    hi I am posting code wherein i am populating my datatable from an excel sheet and reading the sheet name through the user input in textBox5. Inspite of wrong value in the textbox my catch code do not execute and instead the default error page is displayed where as the expected routine is that it displays the message in lblmessage so that user corrects the entry. Try query = "SELECT * FROM [" & TextBox5.Text & "$]" 'Create the connection object conn = New OleDb.OleDbConnection(connString) 'Open connection If conn.State = ConnectionState.Closed Then conn.Open() 'Create the command object cmd = New OleDb.OleDbCommand(query, conn) da = New OleDb.OleDbDataAdapter(cmd) ds = New DataSet() da.Fill(ds) Catch ex As Exception lblMessage.Visible = True lblMessage.Text = (ex.ToString()) Finally conn.Close() End Try may i request guidance from experts to understand the above problem thanks in advance kris

    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