View Single Post
Old 02-17-2006, 06:46 PM   #2 (permalink)
iowacb4600f4guy
Registered User
 
Join Date: Feb 2006
Location: Clive, iowa
Posts: 3
iowacb4600f4guy is on a distinguished road
Send a message via AIM to iowacb4600f4guy
Quote:
Originally Posted by rikb53
Guys if anyone has an answer to this - i'd appreciate some assistance.
the problem is not building the dataset within String Builder - so i can render it as HTML in the email msg body.
the problem is - the dataset can change and return more or less columns than i have here and my DataRows, Im specifing
certain Indexes.
so, one time the dataset will have say, 5 rows in it and the next time it may have say 12. i'm about at the edge of my expertise right now, so any code examples from an expert would be appreciated - other wise the only thing i can think of is to
build separate Stringbuilder Components and pass a number to them that corresponds with the number of columns retrieved.
i've only included enough of the snippets of code in the procedure - to give clarity. i can send all if need be, but the real problem is in the aRow.Item("index")
thanks again for any help.
rik

Public ds As DataSet
Dim oMailMsg As MailMessage = New MailMessage
Dim sb As New StringBuilder
oMailMsg.BodyFormat = MailFormat.Html

sb.Append("<p><img SRC=C:\SelectLogo.gif></p><br>")
For Each aRow In ds.Tables(0).Rows
sb.Append("<table border=1 cellspacing=3><tr><td>" + aRow.Item(0) + "</td>" + "<td>" + aRow.Item(1) + "</td></tr></table>")
Next
oMailMsg.Body = sb.ToString
SmtpMail.Send(oMailMsg)
I am not 100% clear what you are looking for as your post mentions that the rows and columns were your problem. The rows shouldn't be an issue.

The dataset.table object has a "Columns" property that allows you to get a count of the columns. You can then create another loop inside of your for each loop to write out the columns.

If you need some detailed help, post back up or e-mail me and I can see what I can do!
iowacb4600f4guy is offline   Reply With Quote