473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems creating a TVF

My apologies for crossposting this; I originally posted it to
m.p.d.l.vb.data, but then I noticed that the group is not very active so
I decided to post here as well.

Subject: Problems creating a TVF
From: Scott McNair <sm*****@beachexpress.takethispartout.com>
Newsgroups: microsoft.public.dotnet.languages.vb.data

Hi,

I'm trying to create a TVF using the example provided by Microsoft at the
following URL:

http://msdn2.microsoft.com/en-us/library/ms131103.aspx

As written, the code wouldn't compile... it wanted a TableDefinition
defined in InitMethod. So I provided the information, as reflected in
the following code:

Imports System
Imports System.Data.Sql
Imports Microsoft.SqlServer.Server
Imports System.Collections
Imports System.Data.SqlTypes
Imports System.Diagnostics
Imports System.Runtime.InteropServices

Public Class TabularEventLog
<SqlFunction(FillRowMethodName:="FillRow", TableDefinition:
="timeWritten datetime,message nvarchar(4000),category nvarchar
(4000),instanceId bigint")_
Public Shared Function InitMethod(ByVal logname As String) As
IEnumerable
Return New EventLog(logname, Environment.MachineName).Entries
End Function

Public Shared Sub FillRow(ByVal obj As Object, <Out()ByRef
timeWritten As SqlDateTime, <Out()ByRef message As SqlChars, <Out()>
ByRef category As SqlChars, <Out()ByRef instanceId As Long)
Dim eventLogEnTry As EventLogEntry = CType(obj, EventLogEntry)
timeWritten = New SqlDateTime(eventLogEnTry.TimeWritten)
message = New SqlChars(eventLogEnTry.Message)
category = New SqlChars(eventLogEnTry.Category)
instanceId = eventLogEnTry.InstanceId
End Sub
End Class

I compiled the code, and then tried to declare and use the TVF with the
code provided:

CREATE ASSEMBLY tvfEventLog
FROM'C:\PathToProject\SqlServerProject1.dll'
WITH PERMISSION_SET = SAFE
GO
CREATE FUNCTION ReadEventLog(@logname nvarchar(100))
RETURNS TABLE
(logTime datetime,Message nvarchar(4000),Category nvarchar
(4000),InstanceId bigint)
AS
EXTERNAL NAME tvfEventLog.TabularEventLog.InitMethod
GO

However when I try to run the code I get the following error:

"Could not find Type 'TabularEventLog' in assembly 'SqlServerProject1'."

Any ideas?

Regards,
Scott

Dec 5 '07 #1
0 1011

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: news | last post by:
Before I begin, I realise there's a big war regarding HTML in e-mails. Personally, I don't like it. Unfortunately, I'm being paid by my company to create an automated newsletter for our customers....
0
by: Nitec Dev | last post by:
Our setup: server1 ASP database running on IIS5, Outlook 2000 and SQL 2000 on Windows 2000. Server2 runs Windows 2000 with Exchange 2000 using CDO 1.2 MAPI Sessions. Clients use IE5/6 and had...
0
by: google account | last post by:
*sigh* I have done all that I know how.... I am using fedora core1, I believe. I have updated the MySQL version to 4.0.17-0. I am trying this: rpm -i MySQL-python2.1-0.9.2-1.i386.rpm
0
by: Sergej Pioch | last post by:
Hello everybody, im trying hard to automate some tasks in a huge windows environment. This lend me to bigger problems while trying to create new global security groups within active directory....
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
6
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
2
by: Adam Witney | last post by:
Forwarding to the mailing list, as I don't know how to fix it.... ------ Forwarded Message From: Henning Klein <kleinh@rz.uni-potsdam.de> Date: Tue, 22 Jun 2004 22:09:08 +0200 To:...
8
by: BARTKO, Zoltán | last post by:
Hello, folks, I am trying to install pgsql8 on winxp. I tried first to install "as is" with pginstaller beta2-dev3, no luck, it froze, switched off Nod32, froze a little later, ran through the...
2
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres...
3
by: Wilson | last post by:
i am very new to c++ and am creating a new program, below are two seperate parts of the program, made to run seperately, however the constructor in one works (prints "constructing" on the screen),...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.