
Introduction
After publishing my recent article on dynamic menus in C#, several people commented that I
should implement the menu structure in XML instead of Access. Well...fine, I thought, and began
playing around with XML schemas in the VS.NET IDE. I was quickly disappointed with the ability
to create schemas and edit their contents. The IDE was not behaving as the documentations
said it should, and the behavior appeared inconsistent and buggy. Several of you commented
that you were not getting this behavior, but I was. I also wanted an XML schema/data editor
that was independent of the IDE (regardless of the 20MB dotnetfx.exe file that needs to be
installed!).
After browsing CP and google, I didn�t see anything that fell into the category of a
basic schema and data editor, so the following is the result. Even if I�ve duplicated effort,
I�ve learned some things on the way, and having no prior XML experience, this is probably where
the greatest value lies.
There really isn't anything that's rocket science about this, but I'll show some code
anyways.
Loading An XML File
private void mnuOpen_Click(object sender, System.EventArgs e)
{
DialogResult res=openFileDialog.ShowDialog(this);
if (res==DialogResult.OK)
{
string fn=openFileDialog.FileName;
DataSet ds=new DataSet();
ds.ReadXml(fn);
lbTables.Items.Clear();
foreach (DataTable dt in ds.Tables)
{
lbTables.Items.Add(dt.TableName);
}
dataSet=ds;
lbTables.SelectedIndex=0;
fnSchema=fn;
this.Text="XML Database Editor - "+fnSchema;
}
}
This code, after getting a valid XML filename (to the limits that I test it!), loads
the file into a DataSet, which is a built in function of the
DataSet. The table
ListBox
lbTables is then populated
with the table name, by iterating through the data set's tables. The first table is selected
as default,
and the application caption is updated.
Saving A DataSet As An XML File
dataSet.WriteXml(fn, XmlWriteMode.WriteSchema);
This statement writes all the data for all the tables, and with the
XmlWriteMode.WriteSchema option, also writes the schema for the
DataSet.
Thus, the XML file has the complete description of the database and all of its data.
Adding A Table
Tables are added to the
DataSet as described below:
private void btnAddTable_Click(object sender, System.EventArgs e)
{
string tblName=edTableName.Text;
if (!ValidateTableName(tblName))
{
return;
}
DataTable dt=new DataTable(tblName);
currentTable=dt;
lbTables.Items.Add(tblName);
dataSet.Tables.Add(dt);
lbTables.SelectedItem=lbTables.Items[lbTables.FindStringExact(tblName)];
}
This code adds a table to the
ListBox and to the
DataSet, then selects the newly
added table in the
ListBox.
Adding A Column
Columns are added to the currently selected table:
private void btnAddColumn_Click(object sender, System.EventArgs e)
{
string colName=edColumnName.Text;
string colType=cbColumnType.Text;
if ( (!ValidateColumnNameAndType(colName, colType)) ||
(!ValidateSelectedTable()) )
{
return;
}
ListViewItem lvi=lvColumns.Items.Add(colName);
lvi.SubItems.Add(colType);
currentTable.Columns.Add(colName, Type.GetType("System."+colType));
}
In the above code, the column is added to the column
ListView and to the selected table.
Observe the code:
currentTable.Columns.Add(colName, Type.GetType("System."+colType));
When adding a column, the column name and the type is required. The type is determined by
using a great VS.NET function
GetType, which converts a textual representation of
the string to its actual type. In the code, the string "System." is prefixed onto the column
type string so that the conversion routine can find the correct type. The "System." is removed
when displaying column types in the
ListView with the string
Split function,
as described below.
Displaying A Table's Columns
void ShowColumns()
{
lvColumns.Items.Clear();
if (currentTable != null)
{
foreach (DataColumn dc in currentTable.Columns)
{
ListViewItem lvi=lvColumns.Items.Add(dc.ColumnName);
string s=dc.DataType.ToString();
s=s.Split(new Char[] {'.'})[1];
lvi.SubItems.Add(s);
}
}
}
This code iterates through the columns of the current table, extracting the column name
and the column data type, then adding this information to the
ListView.
The Data Grid
Probably the most interesting process is setting up the
DataGrid. The
DataGrid displays
data for the selected table:
private void lbTables_SelectedIndexChanged(object sender,
System.EventArgs e)
{
string tblName=lbTables.Text;
currentTable=dataSet.Tables[tblName];
ShowColumns();
dgData.SetDataBinding(dataSet, tblName);
dgData.CaptionText="Table: "+tblName;
}
The
SetDataBinding function is used to establish the connection
between the
DataGrid and the specific table in the
DataSet. Quite nicely, whenever you change the name of the
table or column, or add/remove columns, the
DataSet automatically updates. There is no code required to update the
DataGrid. Amazing!
Possible VS.NET bug?
One thing I noticed was that, when deleting a table from the
DataSet, the table
still "lingers" in the
DataGrid. If you add a table with the same name, back into the system,
you will notice that it already has columns defined in the
DataGrid. Very strange behavior!
Conclusion
This was a very simple utility to put together and demonstrate some nice things
about VS.NET, and some quirks. For example, you can't change the data type of a column after
it has data. The program could be extended to do this manually, I suppose. But for now,
I don't allow it either (which is too bad, because I occasionally need to change the data type
with existing data).
|
|
 |
 | from DataTable to Query Designer Atzsea Hiducca | 10:49 13 Nov '09 |
|
 |
Your works are so helpful and easy to understand, indeed. Thank you so much.
Now I'm in a deep abyss for a way to a Query Designer succeeded from this XML Database Editor.
It is so difficult to me, honestly. So I'm expecting you for this. Otherwise, are there any hints?
|
|
|
|
 |
 | Thanks was333 | 0:17 5 Nov '08 |
|
 |
Thanks a lot. Get my five
|
|
|
|
 |
 | Need help to read My Advanced XML Prithwish Biswas | 1:41 11 Apr '08 |
|
 |
I have been getting a big problem to handle one XML file. I am developing a Real estate portal for one of my client, and they want to use XML Property data feed providing by point2.com. I am not much expert With XML. I need to read the feed to display in my ASP.NET 2/0 application. Here is my sample XML file. I will be thankfull for your suggestion. (http://platform.point2.com/syndication/E6AAFFBD-30E9-4113-AFD7-EDE1CC3F5700/feed.zip ) See the last few like listings-19.xml
<?xml version="1.0" encoding="utf-8" ?> - <ListingDataFeed xmlns="http://platform.point2.com/schemas/2.0/listingDataFeed"> <PublishDate>2007-07-11T21:36:03Z</PublishDate> <DocumentationUrl>http://platform.point2.com/documentation</DocumentationUrl> <Disclaimer>Information is deemed to be correct but not guaranteed.</Disclaimer> <Copyright>Point2 Technologies, Inc.</Copyright> - <Listings> + <Listing> <ListingID>958035</ListingID> <RegionalMLSNumber publiclyVisible="1">3397854</RegionalMLSNumber> <ListDate>2007-02-26T06:00:00Z</ListDate> <LastUpdateDate>2007-07-09T19:29:00Z</LastUpdateDate> <Status>For Sale</Status> <Title>Condos for Sale in Midtown, Atlanta, Georgia $389,900</Title> <DetailViewUrl>http://platform.point2.com/Report/lct.ashx?lid=958035&aid=XX&url=http%3A%2F%2Fwww.teresablanco.com%2FListing%2FViewListingDetails.aspx%3FListingID%3D958035%26Bb%3DXX%26Cc%3D958035</DetailViewUrl> <Email>XX_958035@platform.point2.com</Email> <WebBugUrl>http://platform.point2.com/Report/dv.ashx?lid=958035&aid=XX</WebBugUrl> <VirtualTourUrl>http://www.teresablanco.com/Listing/VirtualTour.aspx?ListingID=958035</VirtualTourUrl> - <Location> <GeoArea id="207550" type="Neighborhood" name="Midtown" /> <GeoArea id="44569" type="City" name="Atlanta" /> <GeoArea id="289" type="State" name="Georgia" abbreviation="GA" /> <GeoArea id="44" type="Country" name="United States" abbreviation="US" /> <Address publiclyVisible="true" suite="1505">120 Ralph McGill Blvd</Address> <PostalCode>30308</PostalCode> </Location> - <Details> <Description>This is a property to be proud of! Huge, open and bright spaces with a wall of windows is this loft's mark of distinction... not to mention the incredible, unobstructed views of the entire city from a 15th story perch. This home has over 2,000 Square Feet of living space with hardwood floors throughout. Everything has been renovated to a tee with quality materials. The kitchen has granite countertops, stainless appliances and solid wood cabinets, and the master bath has marble countertops and a sauna! The master walk-in closet is huge and designed with custom shelving. A tax abatement keeps the property taxes low... only $1,800 per year! Also, the seller is will pay 18 months of association dues for the buyer with an accepted offer. The building's amenities include a pool, fitness center concierge and two gated parking spaces. The loft also comes with a large storage space. Day or night... enjoy the stunning views from this home of distinction in the heart of Atlanta! <br>*Marketed by Teresa Blanco, Blue Sky Real Estate. Listed by David Jones, Blue Sky Real Estate. Brokered and Advertised by : Blue Sky Real Estate Group</Description> <ListPrice currency="USD">389900</ListPrice> <TaxAmount currency="USD" taxYear="2006">1843</TaxAmount> <PropertyType>Condominium</PropertyType> <HasSuite>false</HasSuite> <Style>Single Story</Style> <YearBuilt>1974</YearBuilt> <Bedrooms>2</Bedrooms> <Bathrooms>2</Bathrooms> <Features /> <Highlights /> </Details> - <Media> + <Item id="9580351" mimeType="image/jpeg" medium="image" caption="View of one of the bedrooms!"> <Url style="Gallery">http://media.point2.com/p2a/listing/7c33/a6dd/7f6f/144c1e3b73e2a67e71e8/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/7c33/a6dd/7f6f/144c1e3b73e2a67e71e8/w64h48.jpg</Url> </Item> - <Item id="9580352" mimeType="image/jpeg" medium="image" caption="Relax in the living room and take in the incredible views!"> <Url style="Gallery">http://media.point2.com/p2a/listing/a0e5/2702/685e/8b7fd1fb35da34b1e966/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/a0e5/2702/685e/8b7fd1fb35da34b1e966/w64h48.jpg</Url> </Item> - <Item id="9580353" mimeType="image/jpeg" medium="image" caption="Renovated bathrooms..."> <Url style="Gallery">http://media.point2.com/p2a/listing/b779/1108/c524/dd51cfb96d4ffaa8b261/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/b779/1108/c524/dd51cfb96d4ffaa8b261/w64h48.jpg</Url> </Item> - <Item id="9580354" mimeType="image/jpeg" medium="image" caption="Entertain friends in the living space in front of breathtaking views!"> <Url style="Gallery">http://media.point2.com/p2a/listing/632a/0f8a/f397/e876e51b28462bece2d6/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/632a/0f8a/f397/e876e51b28462bece2d6/w64h48.jpg</Url> </Item> - <Item id="9580355" mimeType="image/jpeg" medium="image" caption="Wow! Check out this kitchen!"> <Url style="Gallery">http://media.point2.com/p2a/listing/8842/1168/8e2b/e709c93a42ec0f0a5eb5/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/8842/1168/8e2b/e709c93a42ec0f0a5eb5/w64h48.jpg</Url> </Item> </Media> - <ListingAgent> <AgentID>216636</AgentID> <Name>Teresa Blanco</Name> - <ContactInfo> <Telephone name="Work">404-664-4927</Telephone> <WebSite>http://www.teresablanco.com</WebSite> <ProfileUrl>http://NLS.point2.com/members/US/Georgia/Atlanta/Teresa-Blanco/E7D5EE21-A091-4B78-80CF-A588F3B76524.html?Bb=XX&Cc=958035</ProfileUrl> </ContactInfo> - <Media> - <Item mimeType="image/jpeg" medium="image" caption="Agent"> <Url style="Avatar">http://media.point2.com/p2a/user/914e/e240/2d3c/368d5943d0b87cde0140/w160h120.jpg</Url> </Item> - <Item mimeType="image/jpeg" medium="image" caption="Agency"> <Url style="Logo">http://media.point2.com/p2a/agency/bf4c/9c4b/9561/638f22f013dbc6597213/w160h120.jpg</Url> </Item> </Media> </ListingAgent> - <Broker> <Name>Blue Sky Real Estate Group</Name> </Broker> </Listing> + <Listing> <ListingID>958041</ListingID> <RegionalMLSNumber publiclyVisible="1">326746</RegionalMLSNumber> <ListDate>2007-02-26T06:00:00Z</ListDate> <LastUpdateDate>2007-06-28T20:58:00Z</LastUpdateDate> <Status>Sold</Status> <Title>Homes Sold in Georgetown, Brooklyn, New York $679,000</Title> <DetailViewUrl>http://platform.point2.com/Report/lct.ashx?lid=958041&aid=XX&url=http%3A%2F%2Fwww.brooklynsprimeproperties.com%2FListing%2FViewListingDetails.aspx%3FListingID%3D958041%26Bb%3DXX%26Cc%3D958041</DetailViewUrl> <Email>XX_958041@platform.point2.com</Email> <WebBugUrl>http://platform.point2.com/Report/dv.ashx?lid=958041&aid=XX</WebBugUrl> <VirtualTourUrl>http://www.brooklynsprimeproperties.com/Listing/VirtualTour.aspx?ListingID=958041</VirtualTourUrl> - <Location> <GeoArea id="224934" type="Neighborhood" name="Georgetown" /> <GeoArea id="223941" type="Borough" name="Brooklyn" /> <GeoArea id="98054" type="City" name="City of Greater New York" /> <GeoArea id="517" type="State" name="New York" abbreviation="NY" /> <GeoArea id="44" type="Country" name="United States" abbreviation="US" /> <Address publiclyVisible="true">6602 Avenue M</Address> <PostalCode>11234</PostalCode> <Latitude>40.622878</Latitude> <Longitude>-73.915189999999996</Longitude> </Location> - <Details> <Description>Builders Own Home - Beautiful - 5 year young - 1 family semi-attached corner property with fenced in private driveway. Very large eat in Kitchen, opens to deck and backyard. Living room has surround sound / 3 BR / 2 1/2 bath - Full finished basement with full bath. Basement has separate entrance. Brokered and Advertised by : Brooklyn's Prime Properties, LLC</Description> <ListPrice currency="USD">679000</ListPrice> <TaxAmount currency="USD" taxYear="2006">2412</TaxAmount> <PropertyType>Residential</PropertyType> <HasSuite>false</HasSuite> <Style>2 Story</Style> - <Lot> - <Dimensions> <Length unit="feet">85</Length> <Width unit="feet">29</Width> </Dimensions> </Lot> <YearBuilt comment="5 years Young">2002</YearBuilt> <Bedrooms>3</Bedrooms> <Bathrooms comment="Total of 3 1/2 Baths">3</Bathrooms> - <Features> <Feature category="Outdoor">Deck</Feature> <Feature category="Interior">Cooling</Feature> <Feature category="Exterior">Brick</Feature> <Feature category="Exterior">Vinyl</Feature> <Feature category="Interior">Heating</Feature> <Feature category="Interior">Heating</Feature> <Feature category="Security">Alarm System</Feature> <Feature category="Interior">Window Coverings</Feature> <Feature category="Exterior">Siding</Feature> </Features> <Highlights /> </Details> - <Media> - <Item id="9580411" mimeType="image/jpeg" medium="image" caption="IMG_1493"> <Url style="Gallery">http://media.point2.com/p2a/listing/bed5/01e2/209b/f37aac8644535ad700e0/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/bed5/01e2/209b/f37aac8644535ad700e0/w64h48.jpg</Url> </Item> - <Item id="9580412" mimeType="image/jpeg" medium="image" caption="IMG_1492"> <Url style="Gallery">http://media.point2.com/p2a/listing/389c/d313/2b7e/367326f9c9e7ffb1f68c/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/389c/d313/2b7e/367326f9c9e7ffb1f68c/w64h48.jpg</Url> </Item> - <Item id="9580413" mimeType="image/jpeg" medium="image" caption="IMG_1494"> <Url style="Gallery">http://media.point2.com/p2a/listing/acfa/b66d/3c3c/3a95807022e04ac82406/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/acfa/b66d/3c3c/3a95807022e04ac82406/w64h48.jpg</Url> </Item> - <Item id="9580414" mimeType="image/jpeg" medium="image" caption="IMG_1496"> <Url style="Gallery">http://media.point2.com/p2a/listing/a6ef/f054/34de/09db206adda291b5dcf9/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/a6ef/f054/34de/09db206adda291b5dcf9/w64h48.jpg</Url> </Item> - <Item id="9580416" mimeType="image/jpeg" medium="image" caption="IMG_1500"> <Url style="Gallery">http://media.point2.com/p2a/listing/cb09/a4a1/d2c1/2d96ef921a26834dcbcc/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/cb09/a4a1/d2c1/2d96ef921a26834dcbcc/w64h48.jpg</Url> </Item> - <Item id="9580415" mimeType="image/jpeg" medium="image" caption="IMG_1497"> <Url style="Gallery">http://media.point2.com/p2a/listing/86e7/c7ec/3057/13b79b06bebf0cfcc5ec/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/86e7/c7ec/3057/13b79b06bebf0cfcc5ec/w64h48.jpg</Url> </Item> - <Item id="9580417" mimeType="image/jpeg" medium="image" caption="IMG_1498"> <Url style="Gallery">http://media.point2.com/p2a/listing/baa2/bc86/2349/22e68b8ed46671c08c14/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/baa2/bc86/2349/22e68b8ed46671c08c14/w64h48.jpg</Url> </Item> - <Item id="9580418" mimeType="image/jpeg" medium="image" caption="IMG_1499"> <Url style="Gallery">http://media.point2.com/p2a/listing/d1e0/7388/4bdf/703e0932f5fc68228849/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/d1e0/7388/4bdf/703e0932f5fc68228849/w64h48.jpg</Url> </Item> - <Item id="9580419" mimeType="image/jpeg" medium="image" caption="11.26.2006003"> <Url style="Gallery">http://media.point2.com/p2a/listing/8b4e/deb3/80b9/aeeb973890586bec1ade/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/8b4e/deb3/80b9/aeeb973890586bec1ade/w64h48.jpg</Url> </Item> - <Item id="95804110" mimeType="image/jpeg" medium="image" caption="11.26.2006005"> <Url style="Gallery">http://media.point2.com/p2a/listing/b7cd/959b/20d9/1b98ab1907134c4e4047/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/b7cd/959b/20d9/1b98ab1907134c4e4047/w64h48.jpg</Url> </Item> - <Item id="95804111" mimeType="image/jpeg" medium="image" caption="11.26.2006011"> <Url style="Gallery">http://media.point2.com/p2a/listing/f41f/9356/07ad/917043694fff258aa671/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/f41f/9356/07ad/917043694fff258aa671/w64h48.jpg</Url> </Item> - <Item id="95804112" mimeType="image/jpeg" medium="image" caption="11.26.2006015"> <Url style="Gallery">http://media.point2.com/p2a/listing/ed82/d84e/8fd4/c92f962df651ad08ca49/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/ed82/d84e/8fd4/c92f962df651ad08ca49/w64h48.jpg</Url> </Item> - <Item id="95804113" mimeType="image/jpeg" medium="image" caption="11.26.2006017"> <Url style="Gallery">http://media.point2.com/p2a/listing/940e/d7d2/6ab2/9b58dc81df696a0ff0b0/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/940e/d7d2/6ab2/9b58dc81df696a0ff0b0/w64h48.jpg</Url> </Item> - <Item id="95804114" mimeType="image/jpeg" medium="image" caption="11.26.2006018"> <Url style="Gallery">http://media.point2.com/p2a/listing/938d/7eab/9853/6c92dabfd42129de29ed/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/938d/7eab/9853/6c92dabfd42129de29ed/w64h48.jpg</Url> </Item> - <Item id="95804115" mimeType="image/jpeg" medium="image" caption="11.26.2006020"> <Url style="Gallery">http://media.point2.com/p2a/listing/1356/5c00/70df/08ab9bd64dbd7e5bc1da/w475h356.jpg</Url> <Url style="Thumbnail">http://media.point2.com/p2a/listing/1356/5c00/70df/08ab9bd64dbd7e5bc1da/w64h48.jpg</Url> </Item> </Media> - <ListingAgent> <AgentID>284775</AgentID> <Name>Anthony Sciortino</Name> - <ContactInfo> <Telephone name="Work">718-551-3751</Telephone> <WebSite>http://www.brooklynsprimeproperties.com</WebSite> <ProfileUrl>http://NLS.point2.com/members/US/New-York/Brooklyn/Anthony-Sciortino/87F2E343-94FA-461A-AD33-4C7207F7CDCE.html?Bb=XX&Cc=958041</ProfileUrl> </ContactInfo> - <Media> - <Item mimeType="image/jpeg" medium="image" caption="Agent"> <Url style="Avatar">http://media.point2.com/p2a/user/7a08/ccef/a409/f5812daf4d5fab2aa8ff/w160h120.jpg</Url> </Item> - <Item mimeType="image/jpeg" medium="image" caption="Agency"> <Url style="Logo">http://media.point2.com/p2a/agency/ef79/9d0e/de31/8ba147d338f0f0404009/w160h120.jpg</Url> </Item> </Media> </ListingAgent> - <Broker> <Name>Brooklyn's Prime Properties, LLC</Name> </Broker> </Listing> - <Listing>
Thanks & regards Prithwish Biswas Director Dynamicark INC, Kolkata. prithwish@dynamicark.com Off:03365357048 +919836254162
|
|
|
|
 |
 | Fit the Bill Onskee1 | 12:21 16 Dec '07 |
|
 |
I needed a quick xml grid editor to edit a few WMP playlists and this did exactly that. Great job. Fyi -- it also upgraded to VS2008 with no problems. Thanks!
|
|
|
|
 |
 | Yet another great article! Preky | 23:11 7 Oct '07 |
|
 |
Thanks for the effort making theses great articles you have been doing these past years Mark!
P.S. I know I'm out of date with these one , but obviously I always stumble at the end on yours
Greatings,
Preky
|
|
|
|
 |
 | Hierarchies Hypnotron | 7:37 13 Sep '07 |
|
 |
Seems to me the strength of XML when it comes to being used to store data is the ease at which it handles hierarchies and particularly hierarchies with unlimited depth. Using it in the way that you do, you pretty much remove this advantage. I had been looking at storing some hierarchical data in a relational database but have since decided that an XML database is better suited. My main problem is I expect to have _very_ large XML databases with arbitrary hierarchy depths and I also dont want to have the entire document loaded in memory at once. I may end up doing what originally made me look into relational databases in the first place and that is using alot of smaller seperate XML files and handling the file management myself. I know that I could use a relational DB to hold XML text but at that point I dont see the point in having the overhead of an embedded db just to store XML.
For now I'm going to try and modify the interface to your program to work with nested hierarchies.
|
|
|
|
 |
 | VB version shalan99 | 3:31 27 Jun '07 |
|
 |
Hi, this is a very good read! does anyone know of a Visual Basic 2005 equivalent of this article?
|
|
|
|
 |
 | Life Saver Priyank Bolia | 5:24 17 Jun '07 |
|
 |
After hours of googling and trying various methods and creating different xsd with namespace problem, content="elementOnly" problem, msdata:IsDataSet="True" problem, your tool made the life a lot easier. Thanks
|
|
|
|
 |
 | How do i change the column width Sudhanshu Gupta | 2:43 10 Jun '06 |
|
 |
Hi, How do I change the column width in your code. I had tried various method but didn't suceeded. Can you help please Thanks in advance,
|
|
|
|
 |
|
 |
Your obviously using VS.Net 2003 and need to apply a DataGridTableStyle, here's an example:
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "MyTable" Dim tbc As New CustomControls.DGCol Dim col As System.Data.DataColumn Dim tbc2 As New CustomControls.DGFontCol
if 1=1 then Dim tbc1 As New DataGridImageCell tbc1.MappingName = col.Caption tbc1.HeaderText = col.Caption tbc1.theImages = images tbc1.Width = 20 tableStyle.GridColumnStyles.Add(tbc1)
ElseIf i = iMsgColumn Then tbc2.MappingName = "Message" tbc2.HeaderText = "Message" tableStyle.GridColumnStyles.Add(tbc2) Else tbc = New CustomControls.DGCol tbc.MappingName = col.Caption tbc.HeaderText = col.Caption tbc.Width = "100" Exit For End If
|
|
|
|
 |
 | Creating database from xml w3Nima | 3:12 13 May '06 |
|
 |
Is any way to build a table base on xml. xsd has some limitation like lentgh of string field.
Any idea.
Thanks
|
|
|
|
 |
 | XML Dokument surfman19 | 13:39 19 Aug '05 |
|
 |
Gerald
06761111111
Sabine
06761234567
how can i automatically read this xml dokument in a DataSet and into a DataGrid? public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.DataGrid dataGrid1; private DataTable currentTable; private DataSet dataSet=new DataSet();
static void Main() { string fn = "Phonebook.xml"; DataSet ds = new DataSet(); ds.ReadXml(fn); dataSet = ds;
// but how to display it in the dataGrid?
Application.Run(new Form1()); } }
and why do you use a SQL Server here? http://www.codeproject.com/soap/dataset.asp[^] bye
|
|
|
|
 |
|
 |
You ought to be able to just say:
DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[0];
|
|
|
|
 |
 | From XML to Relation Database doxuanhuyen | 3:37 12 Mar '03 |
|
 |
Do you have any idea to convert XML Document to Relation Database???
Do Xuan Huyen
|
|
|
|
 |
|
|
 |
 | Problem with PART Table fmarchi | 11:39 20 Nov '02 |
|
 |
Very nice job. I noticed that thing, table PART is in ReadOnly state in DataGrid because table PART has no field NAME. If we create new Table and this table has no field NAME we can't change values of other fields. It'snt a problem with your code but with the DataGrid component. If we have idea i'm interested.
Thanks for your job.
|
|
|
|
 |
 | Malformed XML Jon Taylor | 23:08 2 Oct '02 |
|
 |
Hi Marc,
I like it! But I have one little suggestion. If I load a mal-formed XML file, I get an unhandled exception along the lines of:
An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll.
Would be nice if your application could catch this exception
Cheers, Jon
|
|
|
|
 |
 | Nice DataSet tutorial rhoward | 14:05 1 Oct '02 |
|
 |
Rudimentary, but functional.
|
|
|
|
 |
|
 |
I try to adhere to the KISS principle.
|
|
|
|
 |
|
 |
Another tutorial about DataSets can be found here
Best regards, Alexandru Savescu
|
|
|
|
 |
|
|
Last Updated 30 Sep 2002 |
Advertise |
Privacy |
Terms of Use |
Copyright ©
CodeProject, 1999-2010