.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

Arrange columns from nested table in a dataset that writes into XML file

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net


I have 3 related data tables. I added these tables into a dataset and finally write it to a XML file. But the related columns from table 2 and 3 is appended after all the columns from table 1. How can I have something like:
in a dataset that I write to XML instead of

View Complete Post

More Related Resource Links

Create a XML file from Database table using Dataset



I've got a SQL database with a table named contact with different column such Name, Address, email ...

I would like to generate a XML file based on the table data:


     <name> John</name>

    <address> 100 main street </address>



After some research it looks like I can use a dataset from that table to create my xml.

Being a beginner I cannot find the right steps / syntax to do so.

Is there any tutorial showing how to work with dataset and XLM?

Thank you for your helps 


Dataset has one field, populate a table 2 columns wide n rows deep



A dataset returns a single field of child names, instead of presenting this as a single column table, I would like it to be multi column.

Dataset returns:


I would like to display it as:

Child1 Child2 
Child3 Child4


Import XML File to SQL Table

Here is a brief example of importing an XML file into SQL Server table. This is accomplished by using the BULK option of OPENROWSET to load the file, and then utilizing the XQuery capabilities of SQL Server to parse the XML to normalized table format. This example requires SQL server 2005 or SQL Server 2008.

First, the following XML is saved to XML file C:\Products.xml.

merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

Entity Data Model and database view returning the same columns as there are in a table


When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?

I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.

var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...

Thanks, Jenda

How to create scrolling table for columns in a SharePoint Designer Data View


I have a fairly complex SharePoint Designer 2007 Data View they have added two more requirements.

1. Have the columns on the right side be able to scroll left to right as there is a large number of columns, while the first 3 columns on the left side stay locked in place.  This is only one list not two, and because of some other requirements I have it must remain to be just one list.

2. Then they also need to have scrolling up and down of the entire list with the headers locked in place.

The first requirement is more important than the second, but preferrably I need to do both.

I am new to XSL so not familar with the syntax. Is this something I can do on a custom Data View? Does anyone have any examples of how?

I have a drawing that show how it needs to look but I don't see an option here to upload a graphic.

So here is a link to my graphic example uploaded to my blog area: http://lindachapman.blogspot.com/  or just the image here: http://4.bp.blogspot.com/_aB01ue__NvQ/TGL42MOvrGI/AAAAAAAAAA4/c3xP4uCy4BU/s1600/Scrolling.png

I failed to mention that 3/4 of the columns are HTML Calculated fields wh

SMO classes to generate alter table script to add columns

How to generate ALTER TABLE script to add columns using SMO and c#.

SQLCE table column DefaultValues don't show up in XSD Dataset designer

Using Visual Studio 2008 with SQL CE 3.5, I notice that default values in the creation scripts for the database tables are not reflected in the dataset designer XSD file.  For example, the following SQL script creates the non-nullable table column names "Content" with a default value of 'Image':    "Content" nchar(20) NOT NULL DEFAULT 'Image',But in the column properties of the dataset designer (XSD) panel, this column correctly shows up as non-nullable, but with a DBnull default value as follows:     Name: Content    Allow DBnull: False    DefaultValue: <DBnull>Am I missing something somewhere, or is this a VS bug?  Also, how do I get the XSD file to regenerate after schema changes in the database?  Sqlmetal doesn't do it.Thanks,    -BGood

C#: How to add a row to a child table with a DataSet backing?

On the back end I am using XML files, xsd schemas a DataSet(dsThingPrograms) and DataTables. I have a parent ->child table relationship defined through the DataSet designer as such:   things[RFID(pkey), name] programs[ID(pkey/autogen), name, path, thing_RFID(FK references things->RFID)]   In my code I have:   dsThingPrograms.things.AddthingsRow("lala" , "00ffe4" ); dsThingPrograms.things.WriteXml("path\to\things.xml" , System.Data.XmlWriteMode.WriteSchema);   which works fine. However the problem comes when I try to add a row to the Programs table. When I do:   dsThingPrograms.programs.AddprogramsRow("someprog" , "some\path" , <???>);   VS wants me to add a "dsThingPrograms.thingsRow parentthingsRowByFK_things_programs" where the <???> is. I've tried a bunch of things but I could not satisfy that requirement and can't even get the code to compile. What is supposed to go in there to satisfy the FK property?

Computed Columns in Table Variables or Table Types

I was just looking for confirmation that computed columns can or cannot be used in a @Table Variable or User-Defined Table Type. I'm trying this: declare @testtable as table(  [testcol] as case when [testcol] = '' then 'a' else 'b' end,  [testcol2] varchar(100) ); insert into @testtable select '','someval' insert into @testtable select 'c','someval2' select * from @testtable It all parses fine, but during the first insert an error is returned Msg 402, Level 16, State 1, Line 2 The data types void type and varchar are incompatible in the equal to operator. Thank you, Paul

Mark columns as Identity in multi-table views?

Hello! When you create a view of one table (i.e. SELECT * FROM Table), it marks the table's identity column as an identity col in the view as well. I have a few that selects columns from several nested tables, but they are all related in a main identity column I select as well, but SQL Server doesn't mark this column as identity, is there a way to do it?Shimmy

customize list view table header css file

i need to make table header for my list to be red and on hover to get specific  image so all my site have the same appearence also i need this to reflect to the list view webpart thanks

Upload millions of file records to a table

I have six input files having millions of record. I need to upload these data to my table. How can I upload the details in the most efficient way. Any help on this will be greatly appreciated.

if ssis package writes to excel file that might be open by a user

I have written a package that writes to an excel file to a network folder. Eventually this package will run as a job. What is the best way to handle the situation where someone opens the file or inadvertantly leaving it open while the package is running and and stop the package.? No one needs to modify or write anything to this file after it is finished

File.AppendAllText method writes garbage?

When I execute the below code multiple times on a file, it writes garbage values in file...    string msg = "Ajmera";  File.AppendAllText("F:\\deep.txt", msg);     File content after 15-20 writes :-  ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Why does it happens?

Want to show FormView in Edit mode with specific table columns depending on their Genre??

hi, I have  a table in my database called "Profiles". This holds data on Female and Male personal characteristics. On my aspx, I have a formview in edit mode which is binded to an object data source with a GetDataByUserId Select method which retrieves data from the "Profiles" Table via a DAL. The "Profiles" table has some columns which relates to females only and some just males and some are generic to both. See example below     UserId - / of Type GUID GenreId /  of Type BOOL. Hip Size (For females) Dress Size ( For Females) ChestSize (For Men ) TrouserSize (For Men) Weight ( For both )   When the User logs in , they go to an update Page which has the Formview in Edit Item Mode and contains drop down Lists which are binded to the Users Selected Value. The DDL are in turn bound to their related table such as HIP, Dress, Chest, Trouser etc. Objective If a female user logs in I just want to show them the (Hip Size) DDL  and DressSizeDDL in the Edit item template of the formview and not the ChestSize DDL or  TrouserSize DDL. At present the GetProfileByUserId returns all colums from the table My question is how do I do this and just show DDL which are relevant to the Female or Male Only. In some cases the user may not have selected an item in the previous form so they could also be

changing table columns collations

hi i have a database with "SQL_Latin1_General_CP1_CI_AS" collation i changed it to "Persian_100_BIN" but none of columns collations is not converted to "Persian_100_BIN" and remained in "SQL_Latin1_General_CP1_CI_AS" collation. how i can change all columns collations to "Persian_100_BIN"? tank u.
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