Click here to Skip to main content
15,909,445 members
Home / Discussions / C#
   

C#

 
GeneralRe: Missing / searching 2nd DataItem as independant index in list/combobox Pin
Rob Graham10-Jan-05 10:56
Rob Graham10-Jan-05 10:56 
GeneralDeleting a Row from a DataSet in a DataGrid Pin
joschmo8010-Jan-05 9:08
joschmo8010-Jan-05 9:08 
GeneralRe: Deleting a Row from a DataSet in a DataGrid Pin
DougW4810-Jan-05 15:36
DougW4810-Jan-05 15:36 
GeneralRe: Deleting a Row from a DataSet in a DataGrid Pin
Heath Stewart10-Jan-05 20:09
protectorHeath Stewart10-Jan-05 20:09 
GeneralRe: Deleting a Row from a DataSet in a DataGrid Pin
joschmo8011-Jan-05 1:56
joschmo8011-Jan-05 1:56 
GeneralAccess Security for window based Pin
caheo10-Jan-05 8:48
caheo10-Jan-05 8:48 
GeneralRe: Access Security for window based Pin
Heath Stewart10-Jan-05 20:14
protectorHeath Stewart10-Jan-05 20:14 
QuestionHow to create a typed DataSet at run-time without type definition files (.xsd or .dtd)? Pin
huckfinn10-Jan-05 7:30
huckfinn10-Jan-05 7:30 
Hi!

My goal is to create a typed dataset from an XML file at run-time, meaning that I don't want all columns to be strings, but also integers, floats and so on. The thing is that at run-time, I know about the types of the fields to be created, but I don't have this information in a .xsd or .dtd file and don't want to use schemas in other files.

So here is a sample example XML file:


<?xml version="1.0" encoding="utf-8" ?>
<config xmlns="http://tempuri.org/simple.xsd">
<params>
<SomeFloat>0.25</SomeFloat>
<SomeInt>25</SomeInt>
<SomeString>A string</SomeString>
</params>
</config>

which would gives me something like this:
Name: value: type:
SomeFloat 0.25 string
SomeInt 25 string
SomeString A string string

with the following code:

----------
m_Dataset = new DataSet();
m_Dataset.ReadXml("simple.xml");
//Linking dataset to datasource
DataGrid datagrid = new DataGrid();
dataGrid1.DataSource = m_Dataset;
//Selecting the node that is of interest
dataGrid1.DataMember = "params";
dataGrid1.CaptionText = dataGrid1.DataMember;
---------

I know at run-time that SomeFloat is a float, SomeInt an int and son on. So before I load the XML, I would like to specify programmatically the table so it would look like this:

Name: value: type:
SomeFloat 0.25 float
SomeInt 25 int
SomeString A string string


How can I make sure that the type of the columns won't be only strings? How can I specify these types? Should I create the table in the dataset first?

Thanks!

Huck
Generalcomparing arrays Pin
sciamachy10-Jan-05 6:50
sciamachy10-Jan-05 6:50 
GeneralRe: comparing arrays Pin
Judah Gabriel Himango10-Jan-05 8:01
sponsorJudah Gabriel Himango10-Jan-05 8:01 
QuestionCan I use webservice to download a file to my local app? Pin
Joshscorp10-Jan-05 6:46
Joshscorp10-Jan-05 6:46 
AnswerRe: Can I use webservice to download a file to my local app? Pin
Judah Gabriel Himango10-Jan-05 8:06
sponsorJudah Gabriel Himango10-Jan-05 8:06 
GeneralRe: Can I use webservice to download a file to my local app? Pin
Joshscorp10-Jan-05 12:44
Joshscorp10-Jan-05 12:44 
GeneralRe: Can I use webservice to download a file to my local app? Pin
Judah Gabriel Himango11-Jan-05 3:56
sponsorJudah Gabriel Himango11-Jan-05 3:56 
GeneralAssembly Path Pin
Wender Oliveira10-Jan-05 5:22
Wender Oliveira10-Jan-05 5:22 
GeneralScreen Capture Pin
Amy Yang10-Jan-05 4:13
Amy Yang10-Jan-05 4:13 
GeneralRe: Screen Capture Pin
Nick Parker10-Jan-05 5:53
protectorNick Parker10-Jan-05 5:53 
GeneralRe: Screen Capture Pin
Amy Yang10-Jan-05 16:58
Amy Yang10-Jan-05 16:58 
GeneralDeployment issue Pin
montu337710-Jan-05 3:43
montu337710-Jan-05 3:43 
GeneralVideo Streaming Pin
RockRock10-Jan-05 3:24
RockRock10-Jan-05 3:24 
GeneralC# to J# Syntax Conversion Pin
haroldjclements10-Jan-05 2:58
haroldjclements10-Jan-05 2:58 
GeneralRe: C# to J# Syntax Conversion Pin
Stefan Troschuetz10-Jan-05 3:52
Stefan Troschuetz10-Jan-05 3:52 
GeneralRe: C# to J# Syntax Conversion Pin
Matt Gerrans10-Jan-05 8:51
Matt Gerrans10-Jan-05 8:51 
GeneralRe: C# to J# Syntax Conversion Pin
Harold Clements10-Jan-05 23:59
Harold Clements10-Jan-05 23:59 
GeneralSerial Number of a fresh CD Pin
sharad_sharma_2k10-Jan-05 2:52
sharad_sharma_2k10-Jan-05 2:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.