0

Bit of a puzzler and wondering if it is a ASP.Net issue or my code. When running a ' For Each datarow' if I put any dropdown before the textboxes then any textboxes after are blank even though the code it hit when 'red blodded'. (Offical word?)

Code sample:

    Dim sConnString As String = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("SQLLInk").ConnectionString
    Dim dsNames As SqlDataSource
    dsNames = New SqlDataSource
    dsNames.ConnectionString = sConnString
    Dim sSQL As String
    Dim vID As String
    vID = (sender.SelectedValue.ToString)
    sSQL = "SELECT * FROM tblExpenses WHERE ID = '" & Session.Item("ID").ToString & "'"
    dsNames.SelectCommand = sSQL

    For Each datarow As Data.DataRowView In dsNames.Select(DataSourceSelectArguments.Empty)

        lblEmployeeID.Text = datarow("EmployeeID").ToString
        lblReceiptFile.Text = datarow("ReceiptFile").ToString
        txtAdminNotes.Text = datarow("AdminNotes").ToString
        '##########################################
        'if I put ddProgress before any of the above they appear blank 
        ddProgress.Text = datarow("Progress").ToString
    Next
indofraiser
  • 1,014
  • 3
  • 18
  • 50
  • Empty catch blocks are [evil](http://stackoverflow.com/questions/1234343/why-are-empty-catch-blocks-a-bad-idea). I assume the `ddProgress` line in the loop causes an exception which is swallowed unfortunately. That's the reason for your empty `TextBoxes` if you change the order. – Tim Schmelter Sep 19 '13 at 14:22
  • Yes, I had other things in there. Cut out the bits I did not need (same error occurs). Edited to reflect this. – indofraiser Sep 19 '13 at 14:26

0 Answers0