.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

Build ArrayList with the values from each column returned from 1 record

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

I have a procedure that is used to look up user permissions in our custom table, There is 1 record for each user and about 20 columns for each of the permissions.

How can i take the column values and place into an array?

All the column are bit type and 1 is int. Is it possible to take the values returned and add to an ArrayList?

And then once the values are in the array, how to loop thru it and go to certain index to check the value.

This is what i have now:

   public ArrayList getPermissions(string uid)
        ArrayList list = new ArrayList();
        using (SqlConnection conn = new SqlConnection(this.connDB))
        using (SqlCommand cmd = new SqlCommand())
                cmd.Connection = conn;
                cmd.CommandText = "Select_User_Perm";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@id", uid);
                SqlDataAdapter a = new SqlDataAdapter(cmd);
                DataSet ds = new DataSet();
//Starting here, not sure how to grap each column, I've used this before but the table contained multiple records for user, so the below wor

View Complete Post

More Related Resource Links

Configure BDC column to have multiple values selected


How do I Configure BDC column to have multiple values selected and make multiple entities data available in the same column.  Currently it supports only single value for an item.  This requirement is crucial need some solution immediately.

BDC Column with Ability to Select Multiple Values


Use Case:

We are creating a storage location for technical product articles. These will be SharePoint publishing pages. Each page will have metadata assigned to it to make it searchable by properties. The possible values for one of the columns (Part Number) could potentially be sourced by our ERP system. I'd like to do this to eliminate the possibility of free-text entry errors, but there are probably over 10,000 parts so a drop-down list isn't feasible.


Ideal Situation:

The end user enters the part number and clicks a button to verify it against a BDC entry from our ERP system. If they weren't sure on the part number they needed, they could do a lookup from that metadata entry screen. They'd need to have the option to add multiple part numbers as one technical product article could reference multiple part numbers.



Is BDC an option for all of this or am I looking at a custom metadata solution? I thought I heard along the way that BDC only supported one value choice, but I couldn't find a verification for that in the forums.



wss2.0 update/delete/hide lookup column that does not display any values


Hi All,

I have a document library that contains a Category column that is a lookup field. This is a default column that is a required field when uploading documents to the document library. The Category column is empty and I am unable to amend, hide, make it not required or delete it.

I have gone to Modify settings and columns -> clicked on the Category field to edit, but there is no option to amend the content or delete it. I am only able to amend the Column name and Description.

Since then, I have amended the column name to eg. Category1 and created a new Category field as a lookup and linked it to the correct list.

The problem I am facing now, is that I cannot hide, delete or make the Category1 (old Category) field NOT required. Either I would like to update the original field to display the correct values or alternately hide, delete or make the column not required.

Please help.

Dual values in Column chart Y axis in SSRS 2008

Hi,  Any one pls tell me how to show dual values in Column chart Y axis. Example: Im showing Total Number of clients in the Y axis of column chart My Requirement is In that Y axis column chart also  i want to show differently of Inactive clients from total number of clients. how to do this pls help me. Thanks in advance. TotalnumberOf clients :  1000 InActive Clients : 200 among TotalnumberofClients      

Drop down boxes in Build Style (Style sheet editor) have no values.

In visual studio 2008, in a Web Application (ASP.net) I open a style sheet, right click and then Select "Build Style"I get the modify Style screen.The font-family drop down box has all of the fonts.The Font-size, font-weight, font-style, font-variant, Drop down boxes are all empty.They are even empty when I select a font.I tried devenv /resetsettingsthat didn't helpI have uninstalled Visual studio 2008 completely, reinstalled,Applied SP1, and did not change any settings.That didn't helpI have googled, nothing.Other people here, at work,Have items in these drop down boxes.Is there something special I need to do to getThose drop down boxes populated?I posted this message in the ASP forum,but they didn't seem to understand.I am having the problem in the Visual Studio 2008 IDE,not on a web page.  Thanks in Advance,  

search on managed metadata column values

I am trying to search on a managed metadata column in a list.  I have the managed metadata as a mapped property (these are automatically set up actually). I have a column frequency (daily, weekly, monthly, yearly) I can enter a search box owstaxIdFrequency=#a132a333-39f1-4737-9ad4-a932482e025f   //this is the taxonomy guid for Daily.  This shows results. How do I search on the word "Daily" in the frequency column?  (I just want to figure it out on a simple search first meaning just using one search box)   I noticed that there are extra maped columns for managed metadata columns (owstaxIdFrequency also has owstaxIdFrequencyx0020Tag, I tried owstaxIdFrequencyx0020Tag="Daily", but it didn't work)

How do I get column values in Sharepoint designer so I can use them as a variable in code block?

The code below is in my EditForm.aspx and it works but instead of it outputting "This is just a test!" I need get a number that is stored in a column named Phone Number that has 5555555555 stored in it and have the line that says TD2.innerHTML = "This is just a test!"; ouput what ever number is stored in the Phone Number column. Here is the code that is in my EditForm.aspx <script type="text/javascript">function DisplayItemID(){       var TD1 = document.createElement("TD");       TD1.className = "ms-formlabel";       TD1.innerHTML = "<h3 class='ms-standardheader'>Test</h3>";       var TD2 = document.createElement("TD");       TD2.className = "ms-formbody";       TD2.innerHTML = "This is just a test!";       var IdRow = document.createElement("TR");       IdRow.appendChild(TD1);       IdRow.appendChild(TD2);       var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0]; 

Display the list column values along with the search result

Hi All, i created custom Scope (to search on specific list) and i need to display all list columns on my search results.  Say i have 2 columns in the list and i have created a scope to search in only in that list. If i do a search in tat scope i would like to get the list values which fits in the search along with the columns as well. thanks jayaraja

Not able to save checkbox values as TRUE on record creation

I have a form I created in InfoPath 2010 on a SharePoint 2010 list. As part of this list, there are 6 yes/no columns.  Each yes/no column I have bound to a different checkbox in the InfoPath form.  In SharePoint, when I view the list and click "add new item", the blank InfoPath form appears, I edit the form and submit it.  All works fine.... EXCEPT the checkboxes.  It seems that the checkboxes always save as FALSE the first time I save a new record. If I save the new record, and then choose to "edit the item", I can set any or all of the checkboxes to true, and it works fine.  But on the initial creation of the record (using InfoPath), the checkboxes always end up being persisted as FALSE. If I create a new record directly in the list (using the datasheet view), I am able to save the yes/no fields as YES, and they persist.  So the problem really does seem to point to the InfoPath form. Any thoughts on how I can persist a TRUE value for these checkboxes when saving for the first time?

Build xml file from gridview values on button click

We are looking to add GoogleMaps to our application. With that said we are going to be using the geocoding api to pass in the lat and long values to pin point locations on the the map. Reading thru the documentation we can pass in the values via XML, so we would like to see how we can take the lat and long values from our gridview and pass that to the API if and when somone clicks on the button to show the map.. The process will work like so, you arrive at the search page, you complete a search, in most if not all cases, you will always get multiple results presented in a gridview. If you should to view them all on the map, you click button and it needs to map out each location on the map. So is there anyway to pull from the gridview the lat, long and description to pass into the API?   Any links to sites that i can review would be great. thanks. 

Wierd case of: Msg 213, Column name or number of supplied values does not match table definition

Hi, I'm working on several triggers (that happen after insert or update) in order to log the changes in a different table. They all follow a similar syntax and are working fine, except for this one... I've reduced the next code to the minimum that gives an error, so we can safely assume the other parts of the trigger are working fine. INSERT INTO [Adt].[WardUnitStayLog] SELECT t.* FROM [Adt].[WardUnitStay] t INNER JOIN inserted i ON i.[Id] = t.[Id]; I've used this same syntax (but on different tables) in other triggers, and these are working perfectly fine. The above query provides the next error: Column name or number of supplied values does not match table definition. I've checked both tables for differences in the columns, but to no avail... (I've checked them manually and by outerjoining the information_schema.columns) (I've also checked the order in wich these columns are defined, they match over the two tables) These are the creation scripts for the tables: CREATE TABLE [Adt].[WardUnitStay] ( [Id] [dbo].[Id] IDENTITY(1,1) NOT NULL, [UnifiedUnitStayId] [dbo].[Id] NOT NULL, [WardCd] [dbo].[Cd] NOT NULL, [_FirstAtTm] [dbo].[Dtm] NOT NULL, [_IsReservation] BIT NOT NULL, [_LastAtTm] [dbo].[Dtm] NOT NULL, [_LastBedCd] [dbo].[Cd] NULL, [_LastPhysicianUid]

How can I replace values in GridView returned from a Stored Procedure

I am working on creating a stored procedure that will output a pivot table.  In the pivot table will be either the string NULL or a number.  How can I reformat this in ASP.NET so the NULL value becomes a blank cell in the gridview and the number (whatever it is) becomes an 'X' ?

Infopath 2007 Repeating Table - Multiple Value Column Text - Hiding Rows based on Column text values

Infopath 2007 browser based form Full Trust Example: I have a repeating table (FruitChoice) that has multiple columns. Both drop down list point to sharepoint list data sources. Choose your tree ft. drop down list – 6Ft Choose your Department drop down list - 103 This repeating table is conditional on the drop down values. This works great. Trees     Fruit       Cost   Date Ordered    Date Delivery Department 6Ft        Peaches                                                        103 3Ft        Apples                                                          102 3Ft        Peaches         &

Infopath 2007 Repeating Table hide row based on Text values of column

Infopath 2007 browser based form Full Trust Example: I have a repeating table (FruitChoice) that has multiple columns. Both drop down list point to sharepoint list data sources. Choose your tree ft. drop down list – 6Ft Choose your Department drop down list - 103 This repeating table is conditional on the drop down values. This works great. Trees     Fruit       Cost   Date Ordered    Date Delivery Department 6Ft        Peaches                                                        103 3Ft        Apples                                                          102 3Ft        Peaches         &

Create unique constraint on a column which has null values

Hi All, I have a table suppose 'Temp' having one of the column as 'ColA' which has some null values as well as non null values. Now i have a requirement to create a unique constraint on it. We have tried but couldnt do it.Apart from having a trigger on insert and update statements is there any other alternate. Can any one please help me on this. Thanks & Regards, Srikanth  

sub totals for column group but not as SUM of groups values but as difference(minus -) between 2 val

I have a tablix control in my report having 3 row groups and 3 column group as Day Vs Last Week Day, Week Vs Last Week and MTD to Last Year MTD, now I want to Subtotal in my report after each group but not as SUM but rather as difference between 1st value of group and 2nd value of group, is this possible in tablix control?

using join when a column may have multiple values

Have 2 tables. Table A has among several columns one called "product_code," which contains 4-digit numerals. Table B has just 2 columns, "product_code," the same 4-digit numerals used in the same column in Table A, and "product_description," which includes a VARCHAR string describing the product referenced by the code. I'm querying Table A and trying to include the "product_description" from Table B with each record returned. Am using a LEFT JOIN like this: SELECT  * FROM Table_A LEFT OUTER JOIN Table_B ON Table_A.product_code = Table_B.prod_code This works fine EXCEPT in cases where Table A has more than one value in "product_code," in which case I get no match in Table B and "NULL" is returned for "product_description." When there is more than one value in the "product_code" column in Table A for a particular record, the values are separated by commas (for example: 1002,1003,9856). How can I get this to work so that for records that have multiple produce codes in table A I get multiple product descriptions from Table B?   Thanks      
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