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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Not showing columns with SqlMetaData in a clr procedure

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

I have a class that has 10 properties that I am retrieving from db.  After I retrieve it and manipulate it (in visual studio using CLR procedure) I set up my SqlMetaData  to only display 9 of the ten columns.  When I deploy the solution and run from SQL, I get no results. 

If I go back and edit my SqlMetaData to show all 10 columns, then I do get the results in SQL. 

How do I set it up so only 9 columns are returned instead of 10?


View Complete Post

More Related Resource Links

Hiding and showing the columns depends upon the filter condition

H,   We developed around 70 ssrs reports for our new application.Its like,all the report names are menrioned in the left hand side and if we click it,.Net calls the SSRS reports and shows the filters in the top of Right hand side.   We will select some filters there and then 'GO', it will fetch records. The issue now is, assume we have 6 columns in the report and depends upon the selection in the filter area, the columns should vanish.is it possible?

Insert the results of a stored procedure into specific columns

Hello, I'm trying to update a table with values from a stored procedure. Here is what I've got: Open My_Cursor DECLARE @username varchar(200), @add1 varchar(200), @add2 varchar(200), @city varchar(200), @st varchar(200), @zip varchar(200) Fetch NEXT FROM MY_Cursor INTO @username WHILE @@FETCH_STATUS = 0 BEGIN insert into sheet1$ (f19,f20,f21,f22,f23) EXEC [dbo].[GetPrimaryEEsAddress] @dependentUsername = @username WHERE username = @username FETCH NEXT FROM MY_Cursor INTO @username END Getting error: Msg 156, Level 15, State 1, Line 11 Incorrect syntax near the keyword 'WHERE'.

Entity Model- Add Function Import - selected stored procedure returns no columns

I am using stored procedures returns columns from pivot table generated dynamically "Execute (@PivotTableSQL)".So the resultset columns cannot be identified. Please let us know how to add function import and Get Column information(create complex Type). Thanks in advance. My stored procedure is alter PROCEDURE spGetQuestGrid( @QID as int)ASBEGIN SET NOCOUNT OFF SET FMTONLY OFF  Declare @optId varchar(10) set @optId = (select DISTINCT Optid from  QuestOptions where  QID = @QID)    DECLARE @PivotColumnHeaders VARCHAR(MAX) SELECT @PivotColumnHeaders =  COALESCE(@PivotColumnHeaders + ', [' + cast(Caption as varchar) + ']' ,  '[' + cast(Caption as varchar)+ ']' ) FROM OptionsDetail where OptId = @optId  DECLARE @PivotTableSQL NVARCHAR(MAX)  SET @PivotTableSQL = 'select * from  ( select  Caption,Optid  from OptionsDetail ) as dt PIVOT  ( min(Optid) FOR Caption IN ( '+ @PivotColumnHeaders + '))as pt'     Execute (@PivotTableSQL)  END 

How do I use a GridView with a Stored Procedure with changing columns?


I have a stored procedure that returns a dataset with a different number of columns and different column names depending on user input.  How can I use this with a GridView?  Normally I define the columns beforehand in a static fashion, but, have never done a dynamic dataset like this.

EntityDataSource not showing all columns


I have an EntityDataSource which when I configure the data source via the wizard, I do the following (and it is driving me NUTS):

Select the only option available for Named Connection: BTSModelContainer which then fills in DefaultContainerName.  When I click on Next, and change the EntitySetName to Jobs I'm missing a couple of the (fairly newly added) columns.  I went through the xml up and down and can't figure out why.  Everything seems to be mapped properly and when I access the properties of a single Job, I see those properties.  The visual map (edmx) shows them, the xml markup shows them, they appear in the strongly-typed entity instance but not in that wizard so I can't get those columns to show up.  Any ideas?

I know this is QUITE long but I'm just going to paste the xml from the model anyway below just so anyone looking at this has it.  I'm missing the Description and DDSId columns and have everything else. Also, just so you know, I've tried adding a new EntityDataSource (even on a completely new aspx page), closing and reopening Visual Studio (2010 / EF 4.0), and deleting that table from the model and readding it with "Update Model from database" and selecting that table.  None of them seemed to do the trick.  Any help would be appreciated.  Thank you in advance!!!

showing NULL under "Amount" and "Type" columns

When i run this code it brings back data for "Amount" and "Type" columns for 1st week only, and for rest of 14 weeks it shows NULL under "Amount" and "Type" columns.
I need to get the date for all 15 weeks under "Amount" and "Type" columns.
@parm_account Varchar(50),
@parm_currency Varchar(10),

@parm_location Varchar(50),

--@parm_month Int,

@parm_week Int,

@parm_year Int

--SET @parm_account = 'CITINETTING-417A'
--SET @parm_account = 'CPS-465-USD'
SET @parm_account = 'WAR-458-USD'

SET @parm_currency = 'USD'

--SET @parm_location = '(417A) - Cebu, Philippines Div. Office TM'
--SET @parm_location = '(465) - Juarez Div. Ofc. (368) - Juarez, Mexico'
SET @parm_location = '(458) - Tampa, FL'

--SET @parm_month = 1

SET @parm_week = 1

SET @parm_year = 2009

CREATE TABLE #date_fill( 

      date   DateTime,

      year   Int,

      week   Int


DECLARE @date_from DateTime

DECLARE @date_to DateTime
--SELECT @date_from = Min(beginday) FROM Lex_Reporting.lex.learfiscalcal WHERE year = @parm_year and month = @parm_month

SELECT @date_from = Min(beginday) FROM Reporting.fiscalcal WHERE year = @parm_year and week = @parm_week

--SELECT @date_to = Max(endday) FROM Reporting.fiscalcal WHERE year = @parm_year and month = @parm_month
SELECT @date_to = (SELECT max(T.MaxEnddate

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

add columns with textboxes in gridview using C#

'm working on a shopping cart in a website and I have my items(which have been added to the cart) in an arraylist. And using these values I've read the rest of the values from the db and and have populated on the gridview successfully.

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Sorting GridView Columns Manually

We all know that GridView columns can be sorted automatically when SQLDataSource is being used. But what if you are not using SqlDataSource to populate the GridView. Sorting the GridView manually is pretty straight forward task take a look at the code below

Send Email from SQL Server Express Using a CLR Stored Procedure

One of the nice things about SQL Server is the ability to send email using T-SQL. The downside is that this functionality does not exist in SQL Server Express. In this tip I will show you how to build a basic CLR stored procedure to send email messages from SQL Server Express, although this same technique could be used for any version of SQL Server.

If you have not yet built a CLR stored procedure, please refer to this tip for what needs to be done for the initial setup.

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


want to execute url without showing that page or url to client.


hello friends,

I need ur help,what i want to do is to execute a url ("To send a text message to client") on client registration but without showing that url page, in short executing url without displaying any page or url to the client.

please help and thanks in advance.

How to let user edit selected gridview columns, not entire row



I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?


Trouble with UpdateProgress showing...


Recently I converted a project to VS.NET2010 and ASP.NET 4.0 (not convinced this is the problem, but regardless this is when the problem began) and now I am having an issue with an AJAX UpdateProgress showing. Here is the abrriviated code:

   <asp:UpdatePanel ID="UpdatePanelPostPageLoad" runat="server">
         <asp:Timer ID="tmrPostPageLoad" Enabled="false" Interval="100" OnTick="PostPageLoad_LoadData"
         <asp:Timer ID="tmrPostPageLoadPt2" Enabled="false" Interval="1" OnTick="PostPageLoad_LoadDataPt2"
         <%--Placing the UpdateProgress inside the UpdatePanel targeted--%>
         <asp:UpdateProgress ID="UpdateProgressPostPageLoad" runat="server" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanelPostPageLoad">
                       Updating blah blah....


Inserting rows via stored procedure and under certain conditions


I'm using Dynamic Data with Entity Framework in VS2010.

Let's say my table has these fields:

PersonID (FK)
LocationID (FK)

Hypothetical scenario (it's easier for me to explain this way, so just bear with me for now)... But let's say each row in the table represents "how many items were sold by such-and-such employee at such-and-such location," where location and person are foreign keys which are referencing other tables.  Basically, there should be no more than a ONE row which has a particular combination of Person and Location.  Makes sense?

So, when inserting new rows using my Dynamic Data app, the insert form displays editable fields for Person (dropdown), Location (dropdown), and Items Sold (textbox).  How do I prevent users from inserting another row into the table containing an already-existing combination of Person and Location?   How do I displaying useful feedback to them in the event that they DO attempt to do this?

I have several thoughts about this, but since I'm new to Dynamic Data, I'm not sure which way to go.  For example:

Option 1:  Use "cascading dropdowns" approach in the insert form and only pull in the "allowed" combinations of the two dropd

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