can this be done

M

Mike

I have a dropdown with states on my web form, when a user selects a state I
need to show rules for that state. There are times that the rules may be
modified, so what I want to do is have all of my state rules in an XML file
(I don't see a need for a database for state rules) and allow the user to
show the rules for the state they select in the drop down and also give a
group of users the ability to update the XML files for states that the rules
that have changed. Is there a way to do this?

so I have
state drop down

user select a state a rules show for that state

on an 'update' page, a user can update a set of rules for 1 or all states. I
will have the update page have a state drop down so the user cannot update
all states at once.
 
S

sloan

Create a new strongly typed DataSet. Call it "StateStuffDS" (or whatever
you want to call it, try to avoid ambiguity)

Add 2 tables (with the columns)

State
StateID (int)
StateName (string)
StateAbbreviation (string)

StateRule
StateRuleID (int)
StateRuleText (string)


If the same rule can be used with multi states, create a link table.

StateToStateRule (table)
StateID (int)
StateRuleID (int)




Then famaliarize yourself with the

DataSet.WriteXml (or is it Write?)
DataSet.MyTable.Select
DataSet.Read ("c:\myfile.xml") (or is it ReadXml?)

methods.


Here is some psedu code.


StateStuffDS ds = new StateStuffDS();

ds.State.AddNewStateRow( 101, "Virginia", "VA");

ds.StateRule.AddNewStateRule ( 1001, "Is For Lovers" );

ds.StateToStateRule.AddStateToStateRule( 101, 1001);

ds.WriteXml (@"C:\myds.xml");

.........................

StateStuffDS anotherDS = new StateStuffDS();
anotherDS.Read("C:\myds.xml");

DataRows[] foundRows = ds.State.Select("StateAbbreviation = 'VA'");



Good luck!
 
M

Mike

I would rather not create a strongly typed DS if I don't have to. Is there
another way to do this, such as using a 'raw' XML file that I define?


sloan said:
Create a new strongly typed DataSet. Call it "StateStuffDS" (or whatever
you want to call it, try to avoid ambiguity)

Add 2 tables (with the columns)

State
StateID (int)
StateName (string)
StateAbbreviation (string)

StateRule
StateRuleID (int)
StateRuleText (string)


If the same rule can be used with multi states, create a link table.

StateToStateRule (table)
StateID (int)
StateRuleID (int)




Then famaliarize yourself with the

DataSet.WriteXml (or is it Write?)
DataSet.MyTable.Select
DataSet.Read ("c:\myfile.xml") (or is it ReadXml?)

methods.


Here is some psedu code.


StateStuffDS ds = new StateStuffDS();

ds.State.AddNewStateRow( 101, "Virginia", "VA");

ds.StateRule.AddNewStateRule ( 1001, "Is For Lovers" );

ds.StateToStateRule.AddStateToStateRule( 101, 1001);

ds.WriteXml (@"C:\myds.xml");

........................

StateStuffDS anotherDS = new StateStuffDS();
anotherDS.Read("C:\myds.xml");

DataRows[] foundRows = ds.State.Select("StateAbbreviation = 'VA'");



Good luck!



Mike said:
I have a dropdown with states on my web form, when a user selects a state
I need to show rules for that state. There are times that the rules may be
modified, so what I want to do is have all of my state rules in an XML
file (I don't see a need for a database for state rules) and allow the
user to show the rules for the state they select in the drop down and also
give a group of users the ability to update the XML files for states that
the rules that have changed. Is there a way to do this?

so I have
state drop down

user select a state a rules show for that state

on an 'update' page, a user can update a set of rules for 1 or all
states. I will have the update page have a state drop down so the user
cannot update all states at once.
 
S

sloan

Sure.

But when you have a known table and column structure (or rather, a known
Entity-Relationship mapping), I think its ... not wise...to not go with the
strong dataset.
Said another way, I think its alot better to go with the strong dataset.
But that's me.


I'll have to defer to someone else for the loose dataset stuff.


If you're avoiding a strong dataset because you don't control the source
xml, then check this blog entry I made:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!148.entry






Mike said:
I would rather not create a strongly typed DS if I don't have to. Is there
another way to do this, such as using a 'raw' XML file that I define?


sloan said:
Create a new strongly typed DataSet. Call it "StateStuffDS" (or
whatever you want to call it, try to avoid ambiguity)

Add 2 tables (with the columns)

State
StateID (int)
StateName (string)
StateAbbreviation (string)

StateRule
StateRuleID (int)
StateRuleText (string)


If the same rule can be used with multi states, create a link table.

StateToStateRule (table)
StateID (int)
StateRuleID (int)




Then famaliarize yourself with the

DataSet.WriteXml (or is it Write?)
DataSet.MyTable.Select
DataSet.Read ("c:\myfile.xml") (or is it ReadXml?)

methods.


Here is some psedu code.


StateStuffDS ds = new StateStuffDS();

ds.State.AddNewStateRow( 101, "Virginia", "VA");

ds.StateRule.AddNewStateRule ( 1001, "Is For Lovers" );

ds.StateToStateRule.AddStateToStateRule( 101, 1001);

ds.WriteXml (@"C:\myds.xml");

........................

StateStuffDS anotherDS = new StateStuffDS();
anotherDS.Read("C:\myds.xml");

DataRows[] foundRows = ds.State.Select("StateAbbreviation = 'VA'");



Good luck!



Mike said:
I have a dropdown with states on my web form, when a user selects a state
I need to show rules for that state. There are times that the rules may
be modified, so what I want to do is have all of my state rules in an XML
file (I don't see a need for a database for state rules) and allow the
user to show the rules for the state they select in the drop down and
also give a group of users the ability to update the XML files for states
that the rules that have changed. Is there a way to do this?

so I have
state drop down

user select a state a rules show for that state

on an 'update' page, a user can update a set of rules for 1 or all
states. I will have the update page have a state drop down so the user
cannot update all states at once.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,099
Latest member
AmbrosePri
Top