Loading

dv.Table.Rows

  1. Imports System.Data
  2. Imports MySql.Data.MySqlClient
  3.  
  4. Partial Class test
  5.     Inherits System.Web.UI.Page
  6.  
  7.     Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
  8.  
  9.         Dim strSQL As String = ""
  10.         strSQL &= "SELECT id, item_name, lang_en "
  11.         strSQL &= "FROM language_file_v2 "
  12.         strSQL &= "WHERE item_name = 'SiteLandingPageBodyLoggedIn' OR item_name = 'SiteHomePageMySpecificJobs' OR item_name = 'SiteLandingPageBodyLoggedOut'"
  13.  
  14.         Using conn As New MySqlConnection(ConfigurationManager.ConnectionStrings("customer_support_devConnectionString").ConnectionString)
  15.             Using da As New MySqlDataAdapter(strSQL, conn)
  16.  
  17.                 Dim dt As New DataTable()
  18.                 da.Fill(dt)
  19.  
  20.                 Dim dv As DataView = dt.AsDataView()
  21.  
  22.                 ' This works, but because I do not know what order the results will be returned in I cannot use Rows(0)
  23.                 ' as it may not be row 0 that I need. So instead of dv.Table.Rows(0)("lang_en").ToString() I need a way
  24.                 ' to specifically display the value in SiteLandingPageBodyLoggedOut
  25.                 '
  26.                 ' eg    dv.Table.Rows("SiteLandingPageBodyLoggedOut")("lang_en").ToString()
  27.  
  28.                 LitSiteLandingPageBody.Text = dv.Table.Rows(0)("lang_en").ToString()
  29.  
  30.             End Using
  31.         End Using
  32.  
  33.     End Sub
  34.  
  35. End Class

Comments