473,769 Members | 5,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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*****@beache xpress.takethis partout.com>
Newsgroups: microsoft.publi c.dotnet.langua ges.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.SqlSe rver.Server
Imports System.Collecti ons
Imports System.Data.Sql Types
Imports System.Diagnost ics
Imports System.Runtime. InteropServices

Public Class TabularEventLog
<SqlFunction(Fi llRowMethodName :="FillRow", TableDefinition :
="timeWritte n datetime,messag e nvarchar(4000), category nvarchar
(4000),instance Id bigint")_
Public Shared Function InitMethod(ByVa l logname As String) As
IEnumerable
Return New EventLog(lognam e, Environment.Mac hineName).Entri es
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(eve ntLogEnTry.Time Written)
message = New SqlChars(eventL ogEnTry.Message )
category = New SqlChars(eventL ogEnTry.Categor y)
instanceId = eventLogEnTry.I nstanceId
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:\PathToP roject\SqlServe rProject1.dll'
WITH PERMISSION_SET = SAFE
GO
CREATE FUNCTION ReadEventLog(@l ogname nvarchar(100))
RETURNS TABLE
(logTime datetime,Messag e nvarchar(4000), Category nvarchar
(4000),Instance Id bigint)
AS
EXTERNAL NAME tvfEventLog.Tab ularEventLog.In itMethod
GO

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

"Could not find Type 'TabularEventLo g' in assembly 'SqlServerProje ct1'."

Any ideas?

Regards,
Scott

Dec 5 '07 #1
0 1024

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

Similar topics

7
2213
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. I did all I could just to get them to allow me to have it sent in both plaintext and HTML so that the e-mail clients have a choice. Anyway. I've looked around the RFC's and the source of similar e-mails, and I'm certain I figured out how to do...
0
4663
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 Outlook 2000 installed. Upgraded to ASP running on IIS6, Outlook 2000 and SQL 2000 on Windows 2003. Server2 runs windows 2003 with Exchange 2003 using CDO 1.2 MAPI Sessions. Clients use IE5/6 and have Outlook 2000/2003 installed.
0
1766
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
1536
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. First I tried to add the groups as discribed in article "Creating Groups" at Platform SDK: System.DirectoryServices documentation. I figuerd out that something in the article was missing, because groupcreation ended in an error: "A constraint...
2
3182
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 problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
6
10217
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 message: "The process cannot access the file "whatever" because it is being used by another process." I've even tried opening another file using the same streamwriter object before deleting the original file, but it's no use. Something keeps...
2
1771
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: awitney@sghms.ac.uk Subject: problems with installing postgres hi,
8
2156
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 list of services, switched off anything that seemed to be a firewall, no luck. So I compiled beta3 with mingw, installed, and now initdb keeps telling me this:
2
3276
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 and arrays of pointers to them. I have gotten the program to compile with gcc on WinXP. If the file i read doesnt have alot of records, it runs thru. But once i add more, it dies. In this program i have 4 files setup to read. The
3
1653
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), while the constructor in the other doesnt. Can you please help me understand why, i think they are almost identical. This one works: #include <cstdio> #include <cstdlib>
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.