dataset data tostring???
-
// 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...
-
// 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...
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 theDataColumn
instance will be faster). I suggest you read the documentation for theDataSet
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