jc,
I made this morning here this message, I never saw it.
\\\
Public Function GetDataSet(ByVal sql As String, ByVal wantedColumn as
integer) As String
If _connected = True Then
Dim da As New SqlDataAdapter(sql, _cnn)
Dim dt As New DataTable
Dim myString as String
da.Fill(dt)
for each dr as DataRow in Dt.Rows
myString = myString &
dr.item(wantedColumn).ToString & ";"
next
Return myString.Substring(0, myString.Length - 1)
End If
End Function
///
This is not tested and is typed here.
You are using only 5 rows, so the purpose of the StringBuilder is low,
however as you have wide columns you better can use the stringbuilder
instead of the concatination of the string.
Cor
"jc" <jo**@webdos.comschreef in bericht
news:ca**********************************@s50g2000 hsb.googlegroups.com...
>I might be able to do this in t-sql, but is there an easy way to do
this in vb.net/ado.net?
Say my function looks like this:
Public Function GetDataSet(ByVal sql As String) As DataSet
If _connected = True Then
Dim da As New SqlDataAdapter(sql, _cnn)
Dim ds As New DataSet
da.Fill(ds)
Return ds
End If
Return Nothing
End Function
and may return a dataset with 5 rows max. I'd like to take the result
from one of the columns and concatinate them into a single string and
return that.
Thanks for any help!