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. ERROR in ds.Tables.Item("SampleID").ToString() [modified]

ERROR in ds.Tables.Item("SampleID").ToString() [modified]

Scheduled Pinned Locked Moved Web Development
helpcsharpasp-netquestion
2 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.
  • H Offline
    H Offline
    hifiger2004
    wrote on last edited by
    #1

    Just disregard this issue. I already solved it guys. Hi Guys, Can you help me if what's wrong with my source code? I am using ASP.Net 2.0 and I got an error in "MsgBox(ds.Tables.Item("SampleID").ToString())" Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim strConnString As String = ConfigurationManager.ConnectionStrings("MyConnection").ConnectionString Dim sqlConn As New Data.SqlClient.SqlConnection(strConnString) Dim cmd As New Data.SqlClient.SqlCommand Dim da As Data.SqlClient.SqlDataAdapter Dim ds As New Data.DataSet cmd.CommandText = "select SampleID, RowID from tblSample where SampleID = 100" cmd.CommandType = CommandType.Text cmd.Connection = sqlConn da = New Data.SqlClient.SqlDataAdapter(cmd) da.Fill(ds) MsgBox(ds.Tables.Item("SampleID").ToString()) MsgBox(ds.Tables.Item(0).Rows(0).Item(1).ToString()) da.Dispose() ds.Dispose() sqlConn.Close() -- modified at 10:03 Saturday 9th June, 2007

    hifiger2004

    T 1 Reply Last reply
    0
    • H hifiger2004

      Just disregard this issue. I already solved it guys. Hi Guys, Can you help me if what's wrong with my source code? I am using ASP.Net 2.0 and I got an error in "MsgBox(ds.Tables.Item("SampleID").ToString())" Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim strConnString As String = ConfigurationManager.ConnectionStrings("MyConnection").ConnectionString Dim sqlConn As New Data.SqlClient.SqlConnection(strConnString) Dim cmd As New Data.SqlClient.SqlCommand Dim da As Data.SqlClient.SqlDataAdapter Dim ds As New Data.DataSet cmd.CommandText = "select SampleID, RowID from tblSample where SampleID = 100" cmd.CommandType = CommandType.Text cmd.Connection = sqlConn da = New Data.SqlClient.SqlDataAdapter(cmd) da.Fill(ds) MsgBox(ds.Tables.Item("SampleID").ToString()) MsgBox(ds.Tables.Item(0).Rows(0).Item(1).ToString()) da.Dispose() ds.Dispose() sqlConn.Close() -- modified at 10:03 Saturday 9th June, 2007

      hifiger2004

      T Offline
      T Offline
      Tom John
      wrote on last edited by
      #2

      For anyone else searching wondering what's wrong, this is server side code, you can't display message boxes that will be visible in the browser. Try writing the field contents to the web page you are creating: Response.Write(ds.Tables.Item("SampleID").ToString())

      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