Thanks tedbilly for the reply. I'm afraid I don't understand how that works based on those examples. I'm not seeing the link between the InitMethod and the FillRow method. This is what I came up with but it seems odd because I'm creating a datatable full of data which is really not what I need. I just want to stream out the results. Thoughts? Do I have to go through all the work of creating a datatable just so I can enumerate?
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports System.Runtime.InteropServ
Partial Public Class UserDefinedFunctions
Public Class TabularEventLog
<SqlFunction(FillRowMethod
Public Shared Function InitMethod(ByVal UserId As Integer) As IEnumerable
Dim outDT As New DataTable
Using adp As New SqlDataAdapter("select fName, lName from SomeTable where userId = " & UserId, New SqlClient.SqlConnection())
adp.Fill(outDT)
End Using
Return outDT.Rows
End Function
Public Shared Sub FillRow(ByVal obj As Object, <Out()> ByRef fName As SqlString, <Out()> ByRef lName As SqlString)
Dim dr As DataRow = DirectCast(obj, DataRow)
fName = New SqlString(CStr(dr.Item("fN
lName = New SqlString(CStr(dr.Item("lN
End Sub
End Class
End Class
Main Topics
Browse All Topics





by: tedbillyPosted on 2007-07-24 at 20:46:13ID: 19562502
Here you go: http://msdn2.microsoft.com /en-us/lib rary/ms131 103.aspx