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 instead of dv.Table.Rows(0)("lang_en").ToString() i need a way to display it based on the value in SiteLandingPageBodyLoggedOut
  23.                 ' because I do not know what order the results will be returned in
  24.                 ' eg    dv.Table.Rows("SiteLandingPageBodyLoggedOut")("lang_en").ToString()
  25.  
  26.                 LitSiteLandingPageBody.Text = dv.Table.Rows(0)("lang_en").ToString()
  27.  
  28.             End Using
  29.         End Using
  30.  
  31.     End Sub
  32.  
  33. End Class

Comments