.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

CLR Table Valued Functions works in Visual Studio but gets permissions errors when I try to use in S

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :

This is a CLR question but here's some backgound first:

I need to talk to a Sybase "Advantage" database server and join results together with some SQL Server data.  I tried using Enterprise manager to link a server to Advantage using both OLE DB and ODBC.  Both types of connections Ping ok when I create then but they also both error out when, from within the linked server screen in enterprise manager, I try to open the tree control to view tables in the database.

I also tried to access the Advantage server using an opendatasource call through both OLE DB and ODBC - both calls errored out with "Invalid object name"

I read the Advantage documentation and I discovered that the drivers - at least the ODBC driver - are a combination of level 1 and level 3 compliance, so I concluded that SQL Server is bombing when it tries to retrieve catalog information after it connects...


I coded up a C# table valued function to retrieve the data that I need using ODBC.  The function works fine from within Visual Studio but now I'm getting CAS errors when I try to use it from within SQL Server.  The issue is security and I'm having trouble figuring out how to tune permissions etc. to get this to work.  Specifically I am getting this error when I try to call t

View Complete Post

More Related Resource Links

HttpHandler works with Visual Studio Development Server debugging, but not otherwise


Hi all,

I'm new to HttpHandlers.  I am writing an HttpHandler that reads uploaded files directly from the request stream to provide progress that can be queried using an AJAX request.  For large files, this seems to be faster than having ASP.NET load the file contents into Request.Files and then streaming the file from there to wherever it goes (Linq to SQL into a VARBINARY column in an SQL Server database.)

My HttpHandler works perfectly when I'm debugging using the Visual Studio Development Server, but doesn't work otherwise.  The application pool for this application in IIS 7 is set to run in Classic Mode, and the Handler Mappings screen in IIS says that I must manage managed handlers in system.web/httpHandlers. 

I set up in my applications Web.config file.

<add verb="GET,POST" path="*.upload" type="Namespace.For.UploadHandler, AssemblyForUploadHandler"/>

It works great, so long as I don't debug with the "Use Local IIS Web server" option.

What else do I need to do to get this to work?


Infopath form using Visual Studio - How to bind repeating table on submit button click ?


Hello friends,

   I have created infopath form using Visual Studio 2008

Form have 3 dropdowns and one repeating table which is bound by Datasource ( List from sharepoint ).

whenever i select appropritae values from drop down, Repeating table gets bound as datasource for dropdown and repeating table are same.

I have done conditional formating for repeating table using repeating table properties.


My Question:


Now i included one submit button and i want when i click submit button it will check DropDown Values and if appropriate record matching these values found it will fill repeating table

How i achive this ? as i dont find how to bind repeating table on submit button.

Please help if anyone have answer.


Thanks and Regards,


Kapil Bhosale.




Ldap authenication code is not working with IIS but works with Visual Studio developement webserver

Hi,I have weird issue here, I have a method that  takes a login Id and authenticates with LDAP active directory and returns the employee Id.It works great when I run the application in Visual studio 2008 ( it uses the default visual studio developement webserver). The code authenitcates the login id and returns emp Id perfectly. But the problem comes when I publish the code to the Local IIS in my developement PC.public string GetEastWestTeamMembersEmployeeID(string loginID)        {            string domain = string.Empty;            string login = string.Empty;            int position = loginID.IndexOf(@"\");            string empid = "";                  System.DirectoryServices.DirectoryEntry directoryEntry = null;            if (position >= 0)            {                domain = loginID.Substring(0, position);    &n

Using Table Adapter in Visual Studio to retrieve data


Hi, I have a profile of member to be displayed. I am using a dataset with all the data table adapter to retrieve the information from database. 

I have a memContact method which has NRIC and Number as a composition primary key. Thus, automatically, the table adapter has created a method called FindByICNum () for me. However, when I do the search to display the contents, i will only need to search by memberic instead. 

Is there anyway to change the table adapter query? 

Event Receiver works through Visual Studio, but not when manually installing solution



I have developed a custom library list definition and also added a event receiver for the ItemUpdating event of the list.

When deploying through Visual Studio 2010 by going to "Build - Deploy", the event fires perfectly when I add a file to the library.

But when manually installing the .wsp (like the client will), the event does not fire at all when I add a document!  Here is what I do to install the .wsp:

  1. Package the solution by going to "Build - Package"
  2. Install the package by running the following command in the "SharePoint 2010 Management Shell": Add-SPSolution -LiteralPath "PATHTOWSP"
  3. In Central Administration, under "System Settings", then "Manage Farm Solutions" - I deploy the WSP

Is there something wrong here?  Could it be a permissions issue, and how do I check?


Accesing usercontrol functions in toolpart in SharePoint 2010 using visual studio



I want to access my usercontrol functions in my toolpart.I've created the object for my usercontrol and called the function in ApplyChanges method.While executing the function,as soon as it encounters my usercontrol(ex:dropdownlist) id,its throwing object reference not set to instance of object error.How do i sove this?Pls help me.



Temporary table in table-valued functions can not be dropped



I have created a table-valued function like:

   @List nvarchar(max)
RETURNS @RtnValue table
   column varchar(255)

SELECT column
   SELECT column
) AS #C
ON A.column = #C.column
WHERE column = @List


However, I find that the #C won't be dropped in the tempdb after the function execution. It can't be remove unless I restarted the server.


If I added:

Drop Table #C

in the function, there will be an error message saying "Cannot access temporary tables from within a function".


Please advice/suggest how can I remove the temp table after the function execution. I am using MSSQL 2005.

P.S. I know that I can use table variable instead, but I don't want to do this since it will involve lots of changes for me. I wish I can just drop the temp table by script or "manually".






.net 3.5/4 PrintServer creation works in Visual Studio (Express) but not stand alone


The following code works without issue from inside Visual Studio (professional or express editions) but when this console app is run from the command line it returns: Win32 Error: The RPC Server is unavailable.

The variations on PrintServer and LocalPrintServer produce the same results.  It's also disappointing that sample code provided at http://msdn.microsoft.com/en-us/library/aa970845(v=VS.100).aspx doesn't work (which is the base of this code)

Prior to installing .net 3.5 framework sdk, I had the same errors as found in this article: http://connect.microsoft.com/VisualStudio/feedback/details/552520/methodaccessexception-when-printqueuecollection-disposed# with PrintServer (as opposed to LocalPrintServer) but the work around of using .net 3.5 didn't solve the problem, just made all the errors of the RPC flavour.  All the obvious things, like ensuring the RPC server is up and running automatically, firewalls turned off (instead of just adding the application - that fails too), and so on don't help any.


Errors while Build the "Forms Authentication Sample" using Visual Studio 2010

Hi All,

      While Build the solution Custom Security Project getting Errors

I am using SharePonit 2010 with Sql Server 2008 R2.

1. I configured Reporting Services and able get the reports using with Windows authentication.

2. Now my web application is Claims Based. Using with Claims Based Auth i need to get the reports. Since 5months i had this task in pending.

I need to configure the Reporting Services using with Forms Auth.

For this  recently i read this link http://technet.microsoft.com/en-us/library/aa902691%28SQL.80%29.aspx#ufairs_topic1

After downloading Code file from above link opened .sln file and converted.

Here added reference 'Microsoft.ReportingServices.Interfaces.dll'  from   C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin this path.

While i am going for build getting these two errors

 1. 'Microsoft.Samples.ReportingServices.CustomSecurity.Authorization' does not implement interface member 'Microsoft.ReportingServices.Interfaces.IAuthorizationExtension.CheckAccess(string, System.IntPtr, byte[], Microsoft.ReportingServices.Interfaces.ModelItemOperation)' C:\Program Files (x86)\Microsoft SQL Server\MSSQL\Reporting Services\Samples\Extensions\FormsAuthe

Visual Studio can't resolve static resource in WPF window, even though it works at run time - why?


I have a WPF window and am using the MVVM pattern. I set the view model as a resource for the window as follows...

  ...other stuff removed for clarity...
  <mvvm:DhrTemplatesViewModel x:Key="viewmodel" />

I want to set the window's data context to use the resource, and found that the following XAML works...

<StaticResource ResourceKey="viewmodel"/>

The problem is that I can only do this by typing the XAML manually, Visual Studio doesn't show the resource anywhere. I can go to the window's properties and click the little icon next to the DataContext property, click the "Apply resource" option, but it doesn't show "viewmodel" as a resource, static or dynamic. If I enter the XAML manually and then open the "Apply resource" pop-up window, it has the "viewmodel" underlined as an error, and hovering over it shows a tooltip "cannot resolve resource reference"

However, when I run the application, it works fine, so the resource is being resolved at run time.

Anyone ab

SQL Server 2008 CLR Table-Valued function works exactly twice, then fails unless assembly reloaded.


Very simple TVF UDF uses WebRequest and HttpWebReponse, passing the response stream off to custom class that implements IEnumerable. First invocation has a good delay (seen many other posters on this issue), second invocation is lightening fast, then all calls after that produce this error:

Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "tvf_OneMinuteBars":
System.Net.WebException: The operation has timed out
   at System.Net.HttpWebRequest.GetResponse()

Now, I've tried all manner of settings on the webrequest: KeepAlive, Timeout (currently 15 secs), Proxy = null. But I just can't figure it out. What is really a bummer is that I can debug invoke this against a local SQL Server as many times as I like. But if I deploy (in VS) to two different servers, or if I manually copy the assembly to the servers and do the CREATE ASSEMBLY / CREATE FUNCTION manually, it always times out after the second invocation.

Here is the tricky part: the object calling GetResponse calls HttpWebResponse.GetResponseStream(), storing the reference in a property. Then the object reference passed to the constructor of a custom class implementing IEnumerable, which does the right things with the response stream. Super fast, n

Insert value using Table Value Functions

a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

ASP.NET 4 and Visual Studio 2010 Web Development Beta 2 Overview

Many exciting changes for ASP.NET are coming in the .NET Framework version 4. This document gives an overview of many of the new features that are included in the Beta 2 release of the .NET Framework 4 and of Visual Studio 2010.

Visual Studio 2010 Beta 2

This is a big deal. This isn't ".NET 3.6" - there are a lot of improvements of .NET 4, and it's not just "pile on a bunch of features so you get overwhelmed." I've been working with and talking to many of the teams involved and even though it's a cheesy thing to say, this is a really customer-focused release.

ASP 4 - Whirlwind Tour around .NET 4 (and Visual Studio 2010) Beta 1

There's a lot of stuff that's new and added in .NET 4, but not in that "overwhelming-I-need-to-relearn-everything" way. More in that, "oh, this is way easier/simpler now" way. Like, moving data around with ADO.NET DataServices is easy, binding with client templates is easy, there's F# if you need it, the "dynamic" keyword if you need it, Silverlight's already installed, oh, and the parallel stuff will freak you out, but in a good way.

Short Overview of SharePoint Features in Visual Studio 2010

As you probably know, Visual Studio 2010 was announced earlier this week and it contains a lot of cool features and project templates for SharePoint developers. Below is a short overview for some of the SharePoint development related features and project templates.

Visual Studio Add-In for Web Parts Generation

This article will introduce you to a new Visual Studio 2005/2008 add-in that can be used for Web Parts generation based on a prepared ASCX control/template. The add-in should allow Web Part developers to easily make Web Parts using the Visual Studio HTML designer. It should save you a lot of time and make Web Part development an enjoying experience even for beginners.

This article is written in the form of a step-by-step tutorial. It will give beginners a chance to successfully make, deploy, and try their first Web Parts, and will save some time for advanced users as you can always run into challenges when working with SharePoint.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend