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. General Programming
  3. C#
  4. dataset data tostring???

dataset data tostring???

Scheduled Pinned Locked Moved C#
csharpvisual-studiocomsysadminhelp
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.
  • G Offline
    G Offline
    gman44
    wrote on last edited by
    #1

    // I'm using Visual Studio C# and the 'EmailMessage' class. Here you see me attempting to retrieve data // from: newDataSet1 (dataset), Settings (table), SmtpServer (data column) and convert ToString (strSmtpServer)! // However what I have below retreives the DataColumn name and NOT the actual data (ie... smtp.yahoo.com). // I feel I'm so close is scarry... //Create the SMTP object using the constructor to specify the mail server string strSmtpServer = (newDataSet1.Settings.SmtpServerColumn.ToString()); SMTP smtpObj = new SMTP (strSmtpServer); //Send the message smtpObj.Send(msgObj); // Have mercy on this newbie and help...

    H 1 Reply Last reply
    0
    • G gman44

      // I'm using Visual Studio C# and the 'EmailMessage' class. Here you see me attempting to retrieve data // from: newDataSet1 (dataset), Settings (table), SmtpServer (data column) and convert ToString (strSmtpServer)! // However what I have below retreives the DataColumn name and NOT the actual data (ie... smtp.yahoo.com). // I feel I'm so close is scarry... //Create the SMTP object using the constructor to specify the mail server string strSmtpServer = (newDataSet1.Settings.SmtpServerColumn.ToString()); SMTP smtpObj = new SMTP (strSmtpServer); //Send the message smtpObj.Send(msgObj); // Have mercy on this newbie and help...

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You need to refer to the row data - not the column:

      string smtpServer =
      newDataSet1.Settings.Rows[0][newDataSet1.Settings.SmtpServerColumn];

      This gets the value in the first row under the SmtpServerColumn (you can also use the name or 0-based index, although using the DataColumn instance will be faster). I suggest you read the documentation for the DataSet class and related documentation. If you're not familiar with this stuff, simply guessing won't teach you anything. Reading the documentation will help, and may be present you with some alternatives in order to do things more efficiently and with less development time.

      Microsoft MVP, Visual C# My Articles

      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