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

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

House of COM: Using ADO to Create XML-based Recordsets

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

More Related Resource Links

Want to create Page URL rewrite based on Users GUID and Display name?



I am using the asp.net membership. 

On my site I have a Profile.aspx page.

In the code behind of this page,  i get the logged in UserId (Guid) and pass

this to a method in my DAL. GetUserByUserId()


In my database I have a Table called Member which the method gets the data from

and displays details on the page about  the user.


What I want to happen is when they have logged in and are diverted to Profile.aspx,

the page URL shows www.MyWebSite/Profile/UsersName 

for example



is this possible. In my Member table I have FirstName and LastName columns or do I get the

name from the membership table.


even better would be they go straight to www.MyWebsite/JohnSmith.aspx


thank you for any help






Create a dimension based on 2 fields

Hello I have a table as follow: No   Placestart    Placeend 1      DK                USA 2      UK                USA 3      USA              DK Now, I want a dimension called Country, which selects either of the rows where a value exist In SQL it would be ex (SELECT * FROM table WHERE placestart = 'USA' OR placeend = 'USA) So, when I select USA in the dimension all 3 rows are listed, as USA is included either in placestart or placeend. If I select DK row 1 and 3 is selected etc... Is this somehow possible?      

How can create site in sharepoint foundation 2010 based on WSS 3.0 template(.stp file)

Hi,   I  want  to migrate wss3.0  site into sharepoint foundation 2010 site . earlier we  were creating site based on .stp file  in WSS 4.0 . but now we  have   to build same site in sharepoint foundation 2010. I followed  the old way  intall the .stp file  and  based on that trying to create new  site  but getting some error  old version template is not supporetd my this version. how could  l able to create  site  in sharepoint foundation 2010 based on wss 3.0 template . Please help Thanks in advance Jandel Singh

How can create site in sharepoint foundation 2010 based on WSS 3.0 template(.stp file)

Hi,   I  want  to migrate wss3.0  site into sharepoint foundation 2010 site . earlier we  were creating site based on .stp file  in WSS 4.0 . but now we  have   to build same site in sharepoint foundation 2010. I followed  the old way  intall the .stp file  and  based on that trying to create new  site  but getting some error  old version template is not supporetd my this version. how could  l able to create  site  in sharepoint foundation 2010 based on wss 3.0 template . Please help Thanks in advance Jandel Singh

Create a progress bar based on progress of AJAX handler

I've got a plain C# web page that uses jQuery to call a handler page using AJAX. While the handler content is loading, a message "Please Wait, loading..." is displayed. Once I've got the content back from the handler I hide the loading message and display the content.What I'd like to do is after the loading message, display a percentage of how far through the handler page is. All the handler page does is loop through a list of members, powered by a web service, and adds them to the database so I know exactly how many members are being added to the database so I can tell how far I am through.The problem I'm having is because all of this goes on in a handler, how can I send the progress percentage back to the main web page while the handler was still loading.Any ideas? If I could do the exact same task but differently which would allow me to create the progress bar, I'd be happy to hear any suggestions.

create multiple columsn based on a passed in variable

Hi, I am clueless as to how the following would be done. Would appreciate imputs: i would be passed in a StartDate and EndDate along with a Period(Week,Month,Quarter,Year).  this would be an INT which is calculated in the following way -- Suppose he selects StartDate = 2010-01-01, EndDate = 2010-02-28, and Period = Weeks ---> Which would mean my resultset would have a additional 9 columns (9 weeks using DateDiff(Week,@startdate,@enddate) The number of fixed columns always will be 4 Total # of records that would always come back is > 10 something like this CategoryTypeId(int),ParentCategory(uniqueidentifier),Id(uniqueidentifier),Name nvarchar(50),Wk1,Wk2.....Wk9 1,xxxx,xxxx,'Shopping',650,300,1275....1000   (i dont't need to total the wk,month,qurter or yearly.This would be taken care on the front end) Thanks!

Create Lookup Site Column based on External List (SharePoint 2010)


I've got an External List and I want to create a Site Column, which is Lookup to a column in my external list. If I tick any of the columns in 'Add a column to show each of these additional fields' and click OK i get the following error message:

[NullReferenceException: Object reference not set to an instance of an object.]
  Microsoft.SharePoint.SPBusinessDataField.IsInDefaultView() +58
  Microsoft.SharePoint.SPBusinessDataField.CreateSpFieldForBdcType(String bdcName, Boolean hidden, Boolean readOnly, Boolean idField, SPAddFieldOptions op) +809
  Microsoft.SharePoint.SPBusinessDataField.AddNeededSecondaryFields(String wssNames, String[] oldNames, String[] newNames, SPAddFieldOptions op) +315
  Microsoft.SharePoint.SPBusinessDataField.OnAdded(SPAddFieldOptions op) +240
  Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol) +759
  Microsoft.SharePoint.SPFieldCollection.Add(SPField field) +61
  Microsoft.SharePoint.ApplicationPages.FieldNewPage.Save() +513
  Microsoft.SharePoint.ApplicationPages.FieldNewPage.BtnOk_Click(Object sender, EventArgs e) +46
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +139

Create controls inside the datagrid cell based on the datatype uisng WPF


I have a requirement that I need to develop a component which should display variable types of data inside a datagrid. The datagrid will have two coulmns. Fisrt column will display the list Captions (like: FirstName, DateOfBirth, IsMarried, Age) and the second column will display the list of data based on their data type, like:

> As FirstName is in string format it should display the value inside a TextBox control on right side of FirstName caption

> As DateOfBirth is in Date format it should display the Date value inside a DatePicker control on right side of DateOfBirth caption

> As IsMarried is in Boolean format it should display the CheckBox control with check state on right side of IsMarried caption

> As Age is in integer format it should display the integr value inside a TextBox Control on right side of Age caption.

If any body has any idea please guide me the way to develop. I request you to kindly help on this for creating this control



How to create a condition and policy to deny access based on host name



With SQL Server 2008 Enterprise, can I prevent an Active Directory Account Login ( domain\user ) from connecting if its coming from a host_name?

What I really need to do is this:  


On SQL1, login mydomain\user1 is only allowed to login from servers APP2, APP3, and APP4.


If mydomain\user1, though it has a login on SQL1 attempts to connection any other hostname besides APP2, APP3 or APP4 I want to deny it access to SQL1.


Can anyone point me in the right direction for the correct condition(s) for a policy that would work?



Erik A. Grob, MCITP, MCDBA

How do i create dimension based on this query



I have cube called client distinct cube.. that cube is been driven by table A and has the following columns

Client-id, Active ,mcd Elibigle and time_Id

and there another table called Eligibles which has the following columns

Client_id, Time_Id, Plan_Id, plan_Id can be 1 -5


I have a created a dimension called client insurance with table eligbles as the base table and i have added 2 more tables called ben-plans and insurance to get the names for it...

SO when i build this dimension i get the STate, and medicaid and its subsidiarys

the dimension and fact tables for this cube is matched by Client ID and when i process this cube and i get 260 distinct clients for med C but if i query those two table for the same time frame i should 620 distinct instead of 260.. I am not sure what i am doing wrong...

basically i want the dimension to be build by the following query

Select distinct a.client-id from tbl_a a, tbl_eligibles e where a.client-Id = e.client-Id and a.time-Id = 54121 and e.time-Id =54121 and e.plan_ID = 5

Any help will be appreciated.



Create SPUser object using user credentials on claims based site.



I would like to create SPSite object and pass user token as an argument to make sure all operations are executed with SharePoint security trimming. Inside SPSite I am reading some file content using File.OpenBinaryStream() method.

I am not sure if there is a way to create SPUser using user credentials. I am able to get SPUser by getting it from SPWeb.AllUsers collection using user login name. However it doesn't work for claims based sites as login name for these users looks like i:0#.w|domain\username. 

Am I allowed to user code like this:

SPUser user = web.AllUsers["i:0#.w|domain\username"];

to get SPUser object? I know that 'w' from 'i:0#.w' string means that it is Windows user. What do other symbols mean? Is there any method which can generate login name from user credentials so I may use it to get SPUser from AllUsers collection?

Possibly there are some other ways to execute code for SPSite under some SharePoint user privileges?

P.S. All my code is running out of SharePoint context. I have tried to user windows impersonation but got Access Denied error.

Thanks beforehand for any help,


create sql server database based on the dataset c#


Hi all,

I am reading xml file using dataset.readxml() method. . . after this i want to send this data to the database. I want c# code to create a database in sql sever and push watever data in the dataset to that created database.... i am dealing with many xml documents... some could be of same format.. lets say... if 2 docs of same format exists... then it shud not create new database or new tables.. it shud push the data to the suitable format...as i am a newbie its a bit confusing for me... i dont even have any idea on how to proceed with this... please reply if you know the answer for any part of the requirement... any help is very much appreciated..




Create Doc Lib View Based on Year in Modfied Field

Hi I'm trying to create a view on a document library that will sort items based on year.  I would need to get the year from the Modified field.  Like maybe I could have one view for 2008, one for 2009, and one for 2010.  I'm new to using formulas in views.  Any ideas?

Create single custom login page for Windows Authentication and Form Based Authentication.


I want to create a custom login page for both Windows Authentication and Form Based Authentication.

I mean to I have to create only single login page for both authentication.

How can I create this kind of page?

G. Goyal

how to create URL from querystring based Url



I have web application which can be accessible by http://localhost:4554/aboutus.aspx?clientid=7 but I would like to create a url which does not have any query string parameter. this should be accessible by http://localhost:4554/aboutus/athar (e.g athar is client name) 

I have got a few samples and ways on url rewriting but still its not working form me. could you help. 

 I have download the Intelligencia.UrlRewriter.dll from the internet. but when I run this i am getting error could not found assemply. 

here is code of my web.config file 

    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
                <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />      

does anyone help or any suggesti

Create a task list from existing task lists based on field values


Hi!  I have a bunch (~10) of different task lists corresponding to different projects; each list has a mixture of Statuses, i.e., some completed, some In Progress, some Not Started.  I'd like to create a (preferably dynamically updated) single task list consisting of all the incomplete tasks from each of the project lists.  After much trial and error (I'm still a relative newbie with DB stuff; even more so w/ Sharepoint stuff) I figured out how to do this by viewing the lists in Access and creating a query which resulted in the compiled list I describe above; however, when I clicked on the "Publish" to Sharepoint button and returned to Sharepoint default view, I couldn't find this new list anywhere (e.g., the new, empty list I had created and changed to Access view, and from which I imported the other lists and created my query, was empty, and my list of task lists in the left side-bar didn't have my query-result-list).

How do I do what I want, w/ or w/out Access?  Thanks!


Create user control fields based on bound properties



I am creating a user control that I would like to be able to generate the form entry fields based on what custom data object the form is bound to. Basically, I have a drop-down box that allows the user to pick what type of data object they are working with (user, address, etc.) That choice will bind the user control to the related data object. No big deal there. I am stuck, however, on how to generate the form fields based on the properties of the object. I feel like I have seen examples of this in WPF but am not able to find them now. All form fields will be simple label, textbox combinations in a stackpanel.

I know more detial will probably be required. Let me know what specifically you would like to know. Any help of direction is greatly appreciated.



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