Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2006

Tip: Looking for answers? Try searching our database.

illegal reference to non-static member?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nick - 18 Apr 2006 21:14 GMT
I got the following error:

Error    1    error C2597: illegal reference to non-static member
'Microsoft::SqlServer::Server::SqlFunctionAttribute::FillRowMethodName'       
when compiling

#include "stdafx.h"

using namespace System;
using namespace System::Data;
using namespace System::Data::Sql;
using namespace System::Data::SqlTypes;
using namespace Microsoft::SqlServer::Server;
using namespace System::Collections;

// select dbo.MyUDF()
// go

public ref class AddNewUDF
{    
public:
   [SqlFunction(SqlFunctionAttribute::FillRowMethodName = "FillRow")]
    static IEnumerable^ MyUDF()
    {
        SqlTypes::SqlString Value(L"Hello");
       DataTable dt;
       dt.Rows->Add("");
       return dt.Rows;
    }

   static void FillRow(Object obj, SqlChars^ message, SqlChars^ category,
long^ instanceId)
   {
       message = gcnew SqlChars("Test");
       category = gcnew SqlChars("Test");
       instanceId = 123;
   }
};

Btw, what's the least cost way to return a one line IEnumerable object?
Marcus Heege - 19 Apr 2006 07:42 GMT
>I got the following error:
>
[quoted text clipped - 34 lines]
>    }
> };

try this

   [SqlFunction(FillRowMethodName = "FillRow")]

instead of this

   [SqlFunction(SqlFunctionAttribute::FillRowMethodName = "FillRow")]

Marcus
Kim Gräsman - 19 Apr 2006 07:44 GMT
Hi nick,

> Error    1    error C2597: illegal reference to non-static member
> 'Microsoft::SqlServer::Server::SqlFunctionAttribute::FillRowMethodName
[quoted text clipped - 3 lines]
>
> [SqlFunction(SqlFunctionAttribute::FillRowMethodName = "FillRow")]

Have you tried not qualifying the named argument? Like so:

[SqlFunction(FillRowMethodName = "FillRow")]

I haven't played with this myself, so this may be hogwash, but it looks like
it's the type qualification that's bothering the compiler.

--
Best regards,
Kim Gräsman

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.