Ask a Question related to ASP.NET General, Design and Development.
-
Leon Shaw #1
XSD VS.Net
After configuring a relation data schema (MyDataSet.xsd) in vs.net, what
code do you use to display that data within two dropdownlist controls (
parent/child) in an web application?
Leon Shaw Guest
-
Marc Hoeppner #2
Re: XSD VS.Net
Hi Leon,
configuring a typed dataset only gets you halfway there (assuming that's
what you are doing with the XSD). What you still need to do by hand is to
write some ADO.NET code to establish the connection with the database and to
actually load stuff in your dataset. For example, you could define a
SqlDataAdapter, specify a SELECT... query and use .Fill with your typed
DataSet as parameter (if you use SQL Server). It may be a little overkill to
define a typed dataset and use a DataAdapter only to fill two dropdownlists.
Take a look at the Data Access Application
Blocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]
?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as easy as this
(C#):
DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
CommandType.Text, "select name, value from mytable" );
MyDropDownList.DataSource = MyDs.Tables[0];
MyDropDownList.DataTextField = "name";
MyDropDownList.DataValueField = "value";
MyDropDownList.DataBind();
Note that using a dataset always has some overhead, so you may want to use a
SqlDataReader for performance.
Best regards,
Marc Hoeppner
NeoGeo
"Leon Shaw" <vnality@msn.com> wrote in message
news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...> After configuring a relation data schema (MyDataSet.xsd) in vs.net, what
> code do you use to display that data within two dropdownlist controls (
> parent/child) in an web application?
>
>
Marc Hoeppner Guest
-
Leon Shaw #3
Re: XSD VS.Net
Ok I have call the adatper.fill and databind command, but is'nt some type of
code such as Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
"DataSet1.xsd" I have to type to get the database schema from the .xsd file
(I have two relate tables in my .xsd file "States" and "School". when you
select a state from the first dropdownlist the second dropdownlist suppose
to populate itself with the correct schools from that state. However, the
first list populate with the states, (I have autopostback set to true, and
the onchange event firing) but after the page postback the state
dropdownlist displays System.Data.RelatedView over and over again. Thanks
for the help!
"Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...to> Hi Leon,
>
> configuring a typed dataset only gets you halfway there (assuming that's
> what you are doing with the XSD). What you still need to do by hand is to
> write some ADO.NET code to establish the connection with the database andto> actually load stuff in your dataset. For example, you could define a
> SqlDataAdapter, specify a SELECT... query and use .Fill with your typed
> DataSet as parameter (if you use SQL Server). It may be a little overkilldropdownlists.> define a typed dataset and use a DataAdapter only to fill twoBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> Take a look at the Data Access Application
>a> ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as easy as this
> (C#):
>
> DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
> CommandType.Text, "select name, value from mytable" );
>
> MyDropDownList.DataSource = MyDs.Tables[0];
> MyDropDownList.DataTextField = "name";
> MyDropDownList.DataValueField = "value";
> MyDropDownList.DataBind();
>
> Note that using a dataset always has some overhead, so you may want to use> SqlDataReader for performance.
>
> Best regards,
>
> Marc Hoeppner
> NeoGeo
>
>
> "Leon Shaw" <vnality@msn.com> wrote in message
> news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...>> > After configuring a relation data schema (MyDataSet.xsd) in vs.net, what
> > code do you use to display that data within two dropdownlist controls (
> > parent/child) in an web application?
> >
> >
>
Leon Shaw Guest
-
Marc Hoeppner #4
Re: XSD VS.Net
Well, basically you can have VS.NET do the grunt work for you. If you
right-click on your project file, select add, then add class, select dataset
and use any name you like (dataset1.xsd) is fine. Now use the server
explorer to drag a few tables in the XSD and use the toolbox to add
references and/or new fields as needed. Now, when you do this and compile
your project, VS.NET will use a tool (XGEN.EXE) to generate a C# file for
you that implements a strongly typed dataset. You can use it like any other
dataset but it is also a strongly typed class with all the parameters that
your tables have. You can also manually change the XSD file or use the GUI
to build your XSD from scratch.
But if all you want to do is to fill two DropDownLists I would recommend to
use the Data Access Application Blocks or simple ADO.NET to get a DataTable
for each table separately and attach these to the dropdownlists.
One other thing: you can help the databind process to find the right columns
to display by the user of DataTextField and DataValueField. For example, if
you have a DataTable with 4 columns (Company, Street, Country, CompanyID)
and you want the ddl to display the Company as text and have the CompanyID
as the value you'd do something like this:
MyDropDownList.DataSource = MyDataTable;
MyDropDownList.DataTextField = "Company";
MyDropDownList.DataValueField = "CompanyID";
MyDropDownList.DataBind();
Hope this helps!!
Best regards,
Marc Höppner
NeoGeo
"Leon Shaw" <vnality@msn.com> wrote in message
news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...of> Ok I have call the adatper.fill and databind command, but is'nt some typefile> code such as Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> "DataSet1.xsd" I have to type to get the database schema from the .xsdto> (I have two relate tables in my .xsd file "States" and "School". when you
> select a state from the first dropdownlist the second dropdownlist suppose
> to populate itself with the correct schools from that state. However, the
> first list populate with the states, (I have autopostback set to true, and
> the onchange event firing) but after the page postback the state
> dropdownlist displays System.Data.RelatedView over and over again. Thanks
> for the help!
>
> "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...> > Hi Leon,
> >
> > configuring a typed dataset only gets you halfway there (assuming that's
> > what you are doing with the XSD). What you still need to do by hand isand> > write some ADO.NET code to establish the connection with the databaseoverkill> to> > actually load stuff in your dataset. For example, you could define a
> > SqlDataAdapter, specify a SELECT... query and use .Fill with your typed
> > DataSet as parameter (if you use SQL Server). It may be a littleBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> to> dropdownlists.> > define a typed dataset and use a DataAdapter only to fill two>> > Take a look at the Data Access Application
> >this> > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as easy asuse> > (C#):
> >
> > DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
> > CommandType.Text, "select name, value from mytable" );
> >
> > MyDropDownList.DataSource = MyDs.Tables[0];
> > MyDropDownList.DataTextField = "name";
> > MyDropDownList.DataValueField = "value";
> > MyDropDownList.DataBind();
> >
> > Note that using a dataset always has some overhead, so you may want towhat> a> > SqlDataReader for performance.
> >
> > Best regards,
> >
> > Marc Hoeppner
> > NeoGeo
> >
> >
> > "Leon Shaw" <vnality@msn.com> wrote in message
> > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...> > > After configuring a relation data schema (MyDataSet.xsd) in vs.net,(> > > code do you use to display that data within two dropdownlist controls>> >> > > parent/child) in an web application?
> > >
> > >
> >
>
Marc Hoeppner Guest
-
Leon Shaw #5
Re: XSD VS.Net
do you have remote desktop. I would like you to see want I'm doing for
yourself. I have did everything you stated, and have reference multiple
books and is yet to solve the problem. I thinking of setting up a parameter
stored procedure to get the state id to binding the right schools for that
state in the dropdownlist. The reason I chose the .xsd relational dataset
route, it easy to define relationships among tables. What do you think?
"Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...dataset> Well, basically you can have VS.NET do the grunt work for you. If you
> right-click on your project file, select add, then add class, selectother> and use any name you like (dataset1.xsd) is fine. Now use the server
> explorer to drag a few tables in the XSD and use the toolbox to add
> references and/or new fields as needed. Now, when you do this and compile
> your project, VS.NET will use a tool (XGEN.EXE) to generate a C# file for
> you that implements a strongly typed dataset. You can use it like anyto> dataset but it is also a strongly typed class with all the parameters that
> your tables have. You can also manually change the XSD file or use the GUI
> to build your XSD from scratch.
>
> But if all you want to do is to fill two DropDownLists I would recommendDataTable> use the Data Access Application Blocks or simple ADO.NET to get acolumns> for each table separately and attach these to the dropdownlists.
>
> One other thing: you can help the databind process to find the rightif> to display by the user of DataTextField and DataValueField. For example,type> you have a DataTable with 4 columns (Company, Street, Country, CompanyID)
> and you want the ddl to display the Company as text and have the CompanyID
> as the value you'd do something like this:
>
> MyDropDownList.DataSource = MyDataTable;
> MyDropDownList.DataTextField = "Company";
> MyDropDownList.DataValueField = "CompanyID";
> MyDropDownList.DataBind();
>
> Hope this helps!!
>
> Best regards,
>
> Marc Höppner
> NeoGeo
>
> "Leon Shaw" <vnality@msn.com> wrote in message
> news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...> > Ok I have call the adatper.fill and databind command, but is'nt someyou> of> file> > code such as Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> > "DataSet1.xsd" I have to type to get the database schema from the .xsd> > (I have two relate tables in my .xsd file "States" and "School". whensuppose> > select a state from the first dropdownlist the second dropdownlistthe> > to populate itself with the correct schools from that state. However,and> > first list populate with the states, (I have autopostback set to true,Thanks> > the onchange event firing) but after the page postback the state
> > dropdownlist displays System.Data.RelatedView over and over again.that's> > for the help!
> >
> > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...> > > Hi Leon,
> > >
> > > configuring a typed dataset only gets you halfway there (assumingtyped> to> > > what you are doing with the XSD). What you still need to do by hand is> and> > > write some ADO.NET code to establish the connection with the database> > to> > > actually load stuff in your dataset. For example, you could define a
> > > SqlDataAdapter, specify a SELECT... query and use .Fill with yourBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> overkill> > > DataSet as parameter (if you use SQL Server). It may be a little>> > to> > dropdownlists.> > > define a typed dataset and use a DataAdapter only to fill two> >> > > Take a look at the Data Access Application
> > >controls> this> > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as easy as> use> > > (C#):
> > >
> > > DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
> > > CommandType.Text, "select name, value from mytable" );
> > >
> > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > MyDropDownList.DataTextField = "name";
> > > MyDropDownList.DataValueField = "value";
> > > MyDropDownList.DataBind();
> > >
> > > Note that using a dataset always has some overhead, so you may want to> what> > a> > > SqlDataReader for performance.
> > >
> > > Best regards,
> > >
> > > Marc Hoeppner
> > > NeoGeo
> > >
> > >
> > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > After configuring a relation data schema (MyDataSet.xsd) in vs.net,> > > > code do you use to display that data within two dropdownlist> (>> >> > > > parent/child) in an web application?
> > > >
> > > >
> > >
> > >
> >
>
Leon Shaw Guest
-
Marc Hoeppner #6
Re: XSD VS.Net
I am not sure I get what you want to do. Could you elaborate a little?
webform2.aspx is not good going practice at all as I load all customers and
all orders into the typed dataset. I think webform1.aspx is a much, much
better implementation (faster, easier to read, easier to change, faster...).
"Leon Shaw" <vnality@msn.com> wrote in message
news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...as> how do do that same code but reference the name of the relationship suchto> (CustomersOrders) in the DataSet1.xsd file to populate the dropdownlist.
>
> "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...> > With regards to your application, I still think there is an easier waytake> do> aware> > that. I am sure you know that by now, but just to be safe: You need be> > that typed datasets don't write the code for you to access and retrieve
> > data. You still need to do all the loading/saving etc. yourself in code.
> > Also, the databinding process for web controls does not automaticallyto> > care of connected tables inside a dataset (typed or not), you also haveNorthwind> > do this yourself.
> >
> > The straight-forward approach to solving your problem (using theedit> > database) is attached to this post on page webform1.aspx. You need toThe> > the connection string and the sample is done using SQL Server or MSDE.and> > typed dataset version is on page webform2.aspx.
> >
> > And yes, I have remote desktop, so we can set up a time if you want tomultiple> > I'll give it a quick look.
> >
> >
> > "Leon Shaw" <vnality@msn.com> wrote in message
> > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...> > > do you have remote desktop. I would like you to see want I'm doing for
> > > yourself. I have did everything you stated, and have referencethink?> that> > parameter> > > books and is yet to solve the problem. I thinking of setting up a> > > stored procedure to get the state id to binding the right schools for> dataset> > > state in the dropdownlist. The reason I chose the .xsd relational> > > route, it easy to define relationships among tables. What do youyou> > >
> > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > Well, basically you can have VS.NET do the grunt work for you. Iffile> > compile> > > > right-click on your project file, select add, then add class, select
> > > dataset
> > > > and use any name you like (dataset1.xsd) is fine. Now use the server
> > > > explorer to drag a few tables in the XSD and use the toolbox to add
> > > > references and/or new fields as needed. Now, when you do this and> > > > your project, VS.NET will use a tool (XGEN.EXE) to generate a C#any> > for> > > > you that implements a strongly typed dataset. You can use it likeparameters> > > other
> > > > dataset but it is also a strongly typed class with all thethe> > that> > > > your tables have. You can also manually change the XSD file or usesome> recommend> > GUI> > > > to build your XSD from scratch.
> > > >
> > > > But if all you want to do is to fill two DropDownLists I would> example,> > > to
> > > > use the Data Access Application Blocks or simple ADO.NET to get a
> > > DataTable
> > > > for each table separately and attach these to the dropdownlists.
> > > >
> > > > One other thing: you can help the databind process to find the right
> > > columns
> > > > to display by the user of DataTextField and DataValueField. For> > CompanyID)> > > if
> > > > you have a DataTable with 4 columns (Company, Street, Country,> > CompanyID> > > > and you want the ddl to display the Company as text and have the> > > > as the value you'd do something like this:
> > > >
> > > > MyDropDownList.DataSource = MyDataTable;
> > > > MyDropDownList.DataTextField = "Company";
> > > > MyDropDownList.DataValueField = "CompanyID";
> > > > MyDropDownList.DataBind();
> > > >
> > > > Hope this helps!!
> > > >
> > > > Best regards,
> > > >
> > > > Marc Höppner
> > > > NeoGeo
> > > >
> > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > Ok I have call the adatper.fill and databind command, but is'nt(assuming> .xsd> > > type
> > > > of
> > > > > code such as Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> > > > > "DataSet1.xsd" I have to type to get the database schema from the> when> > > > file
> > > > > (I have two relate tables in my .xsd file "States" and "School".> However,> > > you
> > > > > select a state from the first dropdownlist the second dropdownlist
> > > suppose
> > > > > to populate itself with the correct schools from that state.> true,> > > the
> > > > > first list populate with the states, (I have autopostback set to> > > and
> > > > > the onchange event firing) but after the page postback the state
> > > > > dropdownlist displays System.Data.RelatedView over and over again.
> > > Thanks
> > > > > for the help!
> > > > >
> > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > Hi Leon,
> > > > > >
> > > > > > configuring a typed dataset only gets you halfway theredefine> hand> > > that's
> > > > > > what you are doing with the XSD). What you still need to do by> > is> > database> > > > to
> > > > > > write some ADO.NET code to establish the connection with the> > > > and
> > > > > to
> > > > > > actually load stuff in your dataset. For example, you couldyour> a> > > > > > SqlDataAdapter, specify a SELECT... query and use .Fill withBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]>> >> > > typed
> > > > > > DataSet as parameter (if you use SQL Server). It may be a little
> > > > overkill
> > > > > to
> > > > > > define a typed dataset and use a DataAdapter only to fill two
> > > > > dropdownlists.
> > > > > > Take a look at the Data Access Application
> > > > > >
> > > > >
> > > >
> > >easy> > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as> as> want> > > > this
> > > > > > (C#):
> > > > > >
> > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
> > > > > > CommandType.Text, "select name, value from mytable" );
> > > > > >
> > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > MyDropDownList.DataTextField = "name";
> > > > > > MyDropDownList.DataValueField = "value";
> > > > > > MyDropDownList.DataBind();
> > > > > >
> > > > > > Note that using a dataset always has some overhead, so you may>> > to> > vs.net,> > > > use
> > > > > a
> > > > > > SqlDataReader for performance.
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Marc Hoeppner
> > > > > > NeoGeo
> > > > > >
> > > > > >
> > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > After configuring a relation data schema (MyDataSet.xsd) in> >> > > > what
> > > > > > > code do you use to display that data within two dropdownlist
> > > controls
> > > > (
> > > > > > > parent/child) in an web application?
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
Marc Hoeppner Guest
-
Leon Shaw #7
Re: XSD VS.Net
So I should set up a store procedure in my MS SQL 2000 database for cities
(@StateID) and get the StateDropDownList.DataValueField and pass that value
(@StateID) to display the correct Schools in the SchoolDropDownlist?
Correct!
"Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...and> I am not sure I get what you want to do. Could you elaborate a little?
>
> webform2.aspx is not good going practice at all as I load all customersfaster...).> all orders into the typed dataset. I think webform1.aspx is a much, much
> better implementation (faster, easier to read, easier to change,retrieve>
> "Leon Shaw" <vnality@msn.com> wrote in message
> news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...> as> > how do do that same code but reference the name of the relationship such> to> > (CustomersOrders) in the DataSet1.xsd file to populate the dropdownlist.
> >
> > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...> > > With regards to your application, I still think there is an easier way> > do> > aware> > > that. I am sure you know that by now, but just to be safe: You need be> > > that typed datasets don't write the code for you to access andcode.> > > data. You still need to do all the loading/saving etc. yourself inhave> take> > > Also, the databinding process for web controls does not automatically> > > care of connected tables inside a dataset (typed or not), you alsofor> to> Northwind> > > do this yourself.
> > >
> > > The straight-forward approach to solving your problem (using the> edit> > > database) is attached to this post on page webform1.aspx. You need to> The> > > the connection string and the sample is done using SQL Server or MSDE.> and> > > typed dataset version is on page webform2.aspx.
> > >
> > > And yes, I have remote desktop, so we can set up a time if you want to> > > I'll give it a quick look.
> > >
> > >
> > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > do you have remote desktop. I would like you to see want I'm doingfor> multiple> > > > yourself. I have did everything you stated, and have reference> > > > books and is yet to solve the problem. I thinking of setting up a
> > > parameter
> > > > stored procedure to get the state id to binding the right schoolsselect> think?> > that> > dataset> > > > state in the dropdownlist. The reason I chose the .xsd relational> > > > route, it easy to define relationships among tables. What do you> you> > > >
> > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > Well, basically you can have VS.NET do the grunt work for you. If> > > > > right-click on your project file, select add, then add class,server> > > > dataset
> > > > > and use any name you like (dataset1.xsd) is fine. Now use theadd> > > > > explorer to drag a few tables in the XSD and use the toolbox toright> file> > > > > references and/or new fields as needed. Now, when you do this and
> > > compile
> > > > > your project, VS.NET will use a tool (XGEN.EXE) to generate a C#> any> > > for
> > > > > you that implements a strongly typed dataset. You can use it like> parameters> > > > other
> > > > > dataset but it is also a strongly typed class with all the> the> > > that
> > > > > your tables have. You can also manually change the XSD file or use> > recommend> > > GUI
> > > > > to build your XSD from scratch.
> > > > >
> > > > > But if all you want to do is to fill two DropDownLists I would> > > > to
> > > > > use the Data Access Application Blocks or simple ADO.NET to get a
> > > > DataTable
> > > > > for each table separately and attach these to the dropdownlists.
> > > > >
> > > > > One other thing: you can help the databind process to find theMe.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath> some> > example,> > > > columns
> > > > > to display by the user of DataTextField and DataValueField. For> > > > if
> > > > > you have a DataTable with 4 columns (Company, Street, Country,
> > > CompanyID)
> > > > > and you want the ddl to display the Company as text and have the
> > > CompanyID
> > > > > as the value you'd do something like this:
> > > > >
> > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > MyDropDownList.DataTextField = "Company";
> > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > MyDropDownList.DataBind();
> > > > >
> > > > > Hope this helps!!
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Marc Höppner
> > > > > NeoGeo
> > > > >
> > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > Ok I have call the adatper.fill and databind command, but is'nt> > > > type
> > > > > of
> > > > > > code such asthe> > > > > > "DataSet1.xsd" I have to type to get the database schema fromdropdownlist> > .xsd> > when> > > > > file
> > > > > > (I have two relate tables in my .xsd file "States" and "School".> > > > you
> > > > > > select a state from the first dropdownlist the secondagain.> > However,> > > > suppose
> > > > > > to populate itself with the correct schools from that state.> > true,> > > > the
> > > > > > first list populate with the states, (I have autopostback set to> > > > and
> > > > > > the onchange event firing) but after the page postback the state
> > > > > > dropdownlist displays System.Data.RelatedView over and overlittle> (assuming> > > > Thanks
> > > > > > for the help!
> > > > > >
> > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > Hi Leon,
> > > > > > >
> > > > > > > configuring a typed dataset only gets you halfway there> define> > hand> > > > that's
> > > > > > > what you are doing with the XSD). What you still need to do by> > > is
> > > > > to
> > > > > > > write some ADO.NET code to establish the connection with the
> > > database
> > > > > and
> > > > > > to
> > > > > > > actually load stuff in your dataset. For example, you could> your> > a> > > > > > > SqlDataAdapter, specify a SELECT... query and use .Fill with> > > > typed
> > > > > > > DataSet as parameter (if you use SQL Server). It may be aBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]>> >> > > > > overkill
> > > > > > to
> > > > > > > define a typed dataset and use a DataAdapter only to fill two
> > > > > > dropdownlists.
> > > > > > > Take a look at the Data Access Application
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >> easy> > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as>> > as> > want> > > > > this
> > > > > > > (C#):
> > > > > > >
> > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
> > > > > > > CommandType.Text, "select name, value from mytable" );
> > > > > > >
> > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > MyDropDownList.DataBind();
> > > > > > >
> > > > > > > Note that using a dataset always has some overhead, so you may> >> > > to
> > > > > use
> > > > > > a
> > > > > > > SqlDataReader for performance.
> > > > > > >
> > > > > > > Best regards,
> > > > > > >
> > > > > > > Marc Hoeppner
> > > > > > > NeoGeo
> > > > > > >
> > > > > > >
> > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > After configuring a relation data schema (MyDataSet.xsd) in
> > > vs.net,
> > > > > what
> > > > > > > > code do you use to display that data within two dropdownlist
> > > > controls
> > > > > (
> > > > > > > > parent/child) in an web application?
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> >
>
Leon Shaw Guest
-
Marc Hoeppner #8
Re: XSD VS.Net
Yes, you can do that!
"Leon Shaw" <vnality@msn.com> wrote in message
news:%23WQEPcvSDHA.632@tk2msftngp13.phx.gbl...value> So I should set up a store procedure in my MS SQL 2000 database for cities
> (@StateID) and get the StateDropDownList.DataValueField and pass thatsuch> (@StateID) to display the correct Schools in the SchoolDropDownlist?
> Correct!
>
>
> "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...> and> > I am not sure I get what you want to do. Could you elaborate a little?
> >
> > webform2.aspx is not good going practice at all as I load all customers> faster...).> > all orders into the typed dataset. I think webform1.aspx is a much, much
> > better implementation (faster, easier to read, easier to change,> >
> > "Leon Shaw" <vnality@msn.com> wrote in message
> > news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...> > > how do do that same code but reference the name of the relationshipdropdownlist.> > as> > > (CustomersOrders) in the DataSet1.xsd file to populate theway> > >
> > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > With regards to your application, I still think there is an easierbe> > to> > > do
> > > > that. I am sure you know that by now, but just to be safe: You needautomatically> retrieve> > > aware
> > > > that typed datasets don't write the code for you to access and> code.> > > > data. You still need to do all the loading/saving etc. yourself in> > > > Also, the databinding process for web controls does notto> have> > take> > > > care of connected tables inside a dataset (typed or not), you also> > to> > Northwind> > > > do this yourself.
> > > >
> > > > The straight-forward approach to solving your problem (using the> > > > database) is attached to this post on page webform1.aspx. You needMSDE.> > edit> > > > the connection string and the sample is done using SQL Server orto> > The> > > > typed dataset version is on page webform2.aspx.
> > > >
> > > > And yes, I have remote desktop, so we can set up a time if you wantIf> for> > and> > > > I'll give it a quick look.
> > > >
> > > >
> > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > > do you have remote desktop. I would like you to see want I'm doing> for> > multiple> > > > > yourself. I have did everything you stated, and have reference> > > > > books and is yet to solve the problem. I thinking of setting up a
> > > > parameter
> > > > > stored procedure to get the state id to binding the right schools> > think?> > > that
> > > > > state in the dropdownlist. The reason I chose the .xsd relational
> > > dataset
> > > > > route, it easy to define relationships among tables. What do you> > > > >
> > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > > Well, basically you can have VS.NET do the grunt work for you.and> select> > you> > > > > > right-click on your project file, select add, then add class,> server> > > > > dataset
> > > > > > and use any name you like (dataset1.xsd) is fine. Now use the> add> > > > > > explorer to drag a few tables in the XSD and use the toolbox to> > > > > > references and/or new fields as needed. Now, when you do thislike> > file> > > > compile
> > > > > > your project, VS.NET will use a tool (XGEN.EXE) to generate a C#> > > > for
> > > > > > you that implements a strongly typed dataset. You can use ituse> > any> > parameters> > > > > other
> > > > > > dataset but it is also a strongly typed class with all the> > > > that
> > > > > > your tables have. You can also manually change the XSD file ora> > the> > > > GUI
> > > > > > to build your XSD from scratch.
> > > > > >
> > > > > > But if all you want to do is to fill two DropDownLists I would
> > > recommend
> > > > > to
> > > > > > use the Data Access Application Blocks or simple ADO.NET to getis'nt> right> > > > > DataTable
> > > > > > for each table separately and attach these to the dropdownlists.
> > > > > >
> > > > > > One other thing: you can help the databind process to find the> > > > > columns
> > > > > > to display by the user of DataTextField and DataValueField. For
> > > example,
> > > > > if
> > > > > > you have a DataTable with 4 columns (Company, Street, Country,
> > > > CompanyID)
> > > > > > and you want the ddl to display the Company as text and have the
> > > > CompanyID
> > > > > > as the value you'd do something like this:
> > > > > >
> > > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > > MyDropDownList.DataTextField = "Company";
> > > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > > MyDropDownList.DataBind();
> > > > > >
> > > > > > Hope this helps!!
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Marc Höppner
> > > > > > NeoGeo
> > > > > >
> > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > > Ok I have call the adatper.fill and databind command, but"School".> Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath> > some> > > > > type
> > > > > > of
> > > > > > > code such as> the> > > > > > > "DataSet1.xsd" I have to type to get the database schema from> > > .xsd
> > > > > > file
> > > > > > > (I have two relate tables in my .xsd file "States" andto> dropdownlist> > > when
> > > > > you
> > > > > > > select a state from the first dropdownlist the second> > > > > suppose
> > > > > > > to populate itself with the correct schools from that state.
> > > However,
> > > > > the
> > > > > > > first list populate with the states, (I have autopostback setstate> > > true,
> > > > > and
> > > > > > > the onchange event firing) but after the page postback theby> again.> > > > > > > dropdownlist displays System.Data.RelatedView over and over> > (assuming> > > > > Thanks
> > > > > > > for the help!
> > > > > > >
> > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > > Hi Leon,
> > > > > > > >
> > > > > > > > configuring a typed dataset only gets you halfway there> > > > > that's
> > > > > > > > what you are doing with the XSD). What you still need to dotwo> little> > define> > > hand
> > > > is
> > > > > > to
> > > > > > > > write some ADO.NET code to establish the connection with the
> > > > database
> > > > > > and
> > > > > > > to
> > > > > > > > actually load stuff in your dataset. For example, you could> > your> > > a
> > > > > > > > SqlDataAdapter, specify a SELECT... query and use .Fill with> > > > > typed
> > > > > > > > DataSet as parameter (if you use SQL Server). It may be a> > > > > > overkill
> > > > > > > to
> > > > > > > > define a typed dataset and use a DataAdapter only to fillBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]>> >> > > > > > > dropdownlists.
> > > > > > > > Take a look at the Data Access Application
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >may> > easy> > > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could be as> > > as
> > > > > > this
> > > > > > > > (C#):
> > > > > > > >
> > > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet( MyConnectionString,
> > > > > > > > CommandType.Text, "select name, value from mytable" );
> > > > > > > >
> > > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > > MyDropDownList.DataBind();
> > > > > > > >
> > > > > > > > Note that using a dataset always has some overhead, so youin> > > want
> > > > to
> > > > > > use
> > > > > > > a
> > > > > > > > SqlDataReader for performance.
> > > > > > > >
> > > > > > > > Best regards,
> > > > > > > >
> > > > > > > > Marc Hoeppner
> > > > > > > > NeoGeo
> > > > > > > >
> > > > > > > >
> > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > > After configuring a relation data schema (MyDataSet.xsd)dropdownlist> > > > vs.net,
> > > > > > what
> > > > > > > > > code do you use to display that data within two>> >> > > > > controls
> > > > > > (
> > > > > > > > > parent/child) in an web application?
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>
Marc Hoeppner Guest
-
Leon Shaw #9
Re: XSD VS.Net
is that a better way, and more efficient way of doing it? However, Thanks
for all the help!
"Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
news:%23QHDd8vSDHA.3132@tk2msftngp13.phx.gbl...cities> Yes, you can do that!
>
> "Leon Shaw" <vnality@msn.com> wrote in message
> news:%23WQEPcvSDHA.632@tk2msftngp13.phx.gbl...> > So I should set up a store procedure in my MS SQL 2000 database forcustomers> value> > (@StateID) and get the StateDropDownList.DataValueField and pass that> > (@StateID) to display the correct Schools in the SchoolDropDownlist?
> > Correct!
> >
> >
> > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...> > > I am not sure I get what you want to do. Could you elaborate a little?
> > >
> > > webform2.aspx is not good going practice at all as I load allmuch> > and> > > all orders into the typed dataset. I think webform1.aspx is a much,need> such> > faster...).> > > better implementation (faster, easier to read, easier to change,> > >
> > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...
> > > > how do do that same code but reference the name of the relationship> dropdownlist.> > > as
> > > > (CustomersOrders) in the DataSet1.xsd file to populate the> way> > > >
> > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > > With regards to your application, I still think there is an easier> > > to
> > > > do
> > > > > that. I am sure you know that by now, but just to be safe: Youwant> be> automatically> > retrieve> > > > aware
> > > > > that typed datasets don't write the code for you to access and> > code.> > > > > data. You still need to do all the loading/saving etc. yourself in> > > > > Also, the databinding process for web controls does not> to> > have> > > take
> > > > > care of connected tables inside a dataset (typed or not), you also> > > to
> > > > > do this yourself.
> > > > >
> > > > > The straight-forward approach to solving your problem (using the
> > > Northwind
> > > > > database) is attached to this post on page webform1.aspx. You need> MSDE.> > > edit
> > > > > the connection string and the sample is done using SQL Server or> > > The
> > > > > typed dataset version is on page webform2.aspx.
> > > > >
> > > > > And yes, I have remote desktop, so we can set up a time if youdoing> to> > > and
> > > > > I'll give it a quick look.
> > > > >
> > > > >
> > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > > > do you have remote desktop. I would like you to see want I'ma> > for> > > > > > yourself. I have did everything you stated, and have reference
> > > multiple
> > > > > > books and is yet to solve the problem. I thinking of setting upschools> > > > > parameter
> > > > > > stored procedure to get the state id to binding the rightrelational> > for> > > > that
> > > > > > state in the dropdownlist. The reason I chose the .xsdto> If> > > > dataset
> > > > > > route, it easy to define relationships among tables. What do you
> > > think?
> > > > > >
> > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > > > Well, basically you can have VS.NET do the grunt work for you.> > select> > > you
> > > > > > > right-click on your project file, select add, then add class,> > server> > > > > > dataset
> > > > > > > and use any name you like (dataset1.xsd) is fine. Now use the> > > > > > > explorer to drag a few tables in the XSD and use the toolboxC#> and> > add> > > > > > > references and/or new fields as needed. Now, when you do this> > > > > compile
> > > > > > > your project, VS.NET will use a tool (XGEN.EXE) to generate aget> like> > > file
> > > > > for
> > > > > > > you that implements a strongly typed dataset. You can use it> use> > > any
> > > > > > other
> > > > > > > dataset but it is also a strongly typed class with all the
> > > parameters
> > > > > that
> > > > > > > your tables have. You can also manually change the XSD file or> > > the
> > > > > GUI
> > > > > > > to build your XSD from scratch.
> > > > > > >
> > > > > > > But if all you want to do is to fill two DropDownLists I would
> > > > recommend
> > > > > > to
> > > > > > > use the Data Access Application Blocks or simple ADO.NET todropdownlists.> a> > > > > > DataTable
> > > > > > > for each table separately and attach these to theFor> > right> > > > > > >
> > > > > > > One other thing: you can help the databind process to find the> > > > > > columns
> > > > > > > to display by the user of DataTextField and DataValueField.the> > > > example,
> > > > > > if
> > > > > > > you have a DataTable with 4 columns (Company, Street, Country,
> > > > > CompanyID)
> > > > > > > and you want the ddl to display the Company as text and havefrom> is'nt> > > > > CompanyID
> > > > > > > as the value you'd do something like this:
> > > > > > >
> > > > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > > > MyDropDownList.DataTextField = "Company";
> > > > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > > > MyDropDownList.DataBind();
> > > > > > >
> > > > > > > Hope this helps!!
> > > > > > >
> > > > > > > Best regards,
> > > > > > >
> > > > > > > Marc Höppner
> > > > > > > NeoGeo
> > > > > > >
> > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > > > Ok I have call the adatper.fill and databind command, but> > Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath> > > some
> > > > > > type
> > > > > > > of
> > > > > > > > code such as> > > > > > > > "DataSet1.xsd" I have to type to get the database schemaset> "School".> > the> > > > .xsd
> > > > > > > file
> > > > > > > > (I have two relate tables in my .xsd file "States" and> > dropdownlist> > > > when
> > > > > > you
> > > > > > > > select a state from the first dropdownlist the second> > > > > > suppose
> > > > > > > > to populate itself with the correct schools from that state.
> > > > However,
> > > > > > the
> > > > > > > > first list populate with the states, (I have autopostbackdo> to> state> > > > true,
> > > > > > and
> > > > > > > > the onchange event firing) but after the page postback the> > again.> > > > > > > > dropdownlist displays System.Data.RelatedView over and over> > > > > > Thanks
> > > > > > > > for the help!
> > > > > > > >
> > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > Hi Leon,
> > > > > > > > >
> > > > > > > > > configuring a typed dataset only gets you halfway there
> > > (assuming
> > > > > > that's
> > > > > > > > > what you are doing with the XSD). What you still need tothe> by> > > > hand
> > > > > is
> > > > > > > to
> > > > > > > > > write some ADO.NET code to establish the connection withcould> > > > > database
> > > > > > > and
> > > > > > > > to
> > > > > > > > > actually load stuff in your dataset. For example, youwith> > > define
> > > > a
> > > > > > > > > SqlDataAdapter, specify a SELECT... query and use .FillBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> two> > little> > > your
> > > > > > typed
> > > > > > > > > DataSet as parameter (if you use SQL Server). It may be a> > > > > > > overkill
> > > > > > > > to
> > > > > > > > > define a typed dataset and use a DataAdapter only to fill>> >> > > > > > > > dropdownlists.
> > > > > > > > > Take a look at the Data Access Application
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >as> > > > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could beMyConnectionString,> > > easy
> > > > as
> > > > > > > this
> > > > > > > > > (C#):
> > > > > > > > >
> > > > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet(> may> > > > > > > > > CommandType.Text, "select name, value from mytable" );
> > > > > > > > >
> > > > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > >
> > > > > > > > > Note that using a dataset always has some overhead, so you> in> > > > want
> > > > > to
> > > > > > > use
> > > > > > > > a
> > > > > > > > > SqlDataReader for performance.
> > > > > > > > >
> > > > > > > > > Best regards,
> > > > > > > > >
> > > > > > > > > Marc Hoeppner
> > > > > > > > > NeoGeo
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > > > After configuring a relation data schema (MyDataSet.xsd)> dropdownlist> > > > > vs.net,
> > > > > > > what
> > > > > > > > > > code do you use to display that data within two>> >> > > > > > controls
> > > > > > > (
> > > > > > > > > > parent/child) in an web application?
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Leon Shaw Guest
-
Leon Shaw #10
Re: XSD VS.Net
I GOT IT TO WORK. THANKS SO MUCH, but so What you are saying is that I don't
even have to use a dataset at all. All I really need to do is use
sqlcommands to pull data into my form for easy selection Then use a dataset
to pull all the information from every form field and update the database?
Correct
"Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
news:OcZIe3wSDHA.2128@TK2MSFTNGP12.phx.gbl...or> The method used in webform1.aspx should be a lot better than using typed
> datasets in this case. Depending on your scenario you could some cachingof> even load all the orders (in this case) in a dataset if all customers get
> selected pretty frequently.
>
> If you still shoot for the typed dataset, you can start with the
> webform2.aspx sample and go from there. You can change the sample to use
> SPROCs instead of inline SQL, but you still will have to do the filteringThanks> the dataset either in T-SQL or by use of the Select or Filter functions in
> DataSet/DataTable manually.
> :)
>
> "Leon Shaw" <vnality@msn.com> wrote in message
> news:OzY2jKwSDHA.1684@TK2MSFTNGP11.phx.gbl...> > is that a better way, and more efficient way of doing it? However,that> > for all the help!
> > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > news:%23QHDd8vSDHA.3132@tk2msftngp13.phx.gbl...> > cities> > > Yes, you can do that!
> > >
> > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > news:%23WQEPcvSDHA.632@tk2msftngp13.phx.gbl...
> > > > So I should set up a store procedure in my MS SQL 2000 database for> > > > (@StateID) and get the StateDropDownList.DataValueField and passmuch,> little?> > > value
> > > > (@StateID) to display the correct Schools in the SchoolDropDownlist?
> > > > Correct!
> > > >
> > > >
> > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...
> > > > > I am not sure I get what you want to do. Could you elaborate a> > customers> > > > >
> > > > > webform2.aspx is not good going practice at all as I load all> > > > and
> > > > > all orders into the typed dataset. I think webform1.aspx is ayourself> relationship> > much> > > > > better implementation (faster, easier to read, easier to change,
> > > > faster...).
> > > > >
> > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...
> > > > > > how do do that same code but reference the name of the> easier> > > such
> > > > > as
> > > > > > (CustomersOrders) in the DataSet1.xsd file to populate the
> > > dropdownlist.
> > > > > >
> > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > > > > With regards to your application, I still think there is an> > need> > > way
> > > > > to
> > > > > > do
> > > > > > > that. I am sure you know that by now, but just to be safe: You> > > be
> > > > > > aware
> > > > > > > that typed datasets don't write the code for you to access and
> > > > retrieve
> > > > > > > data. You still need to do all the loading/saving etc.the> in> also> > > > code.
> > > > > > > Also, the databinding process for web controls does not
> > > automatically
> > > > > take
> > > > > > > care of connected tables inside a dataset (typed or not), you> > > > have
> > > > > to
> > > > > > > do this yourself.
> > > > > > >
> > > > > > > The straight-forward approach to solving your problem (usingor> need> > > > > Northwind
> > > > > > > database) is attached to this post on page webform1.aspx. You> > > to
> > > > > edit
> > > > > > > the connection string and the sample is done using SQL Serverreference> > want> > > MSDE.
> > > > > The
> > > > > > > typed dataset version is on page webform2.aspx.
> > > > > > >
> > > > > > > And yes, I have remote desktop, so we can set up a time if you> > doing> > > to
> > > > > and
> > > > > > > I'll give it a quick look.
> > > > > > >
> > > > > > >
> > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > > > > > do you have remote desktop. I would like you to see want I'm> > > > for
> > > > > > > > yourself. I have did everything you stated, and havetoolbox> up> > > > > multiple
> > > > > > > > books and is yet to solve the problem. I thinking of setting> you> > a> > schools> > > > > > > parameter
> > > > > > > > stored procedure to get the state id to binding the right> > relational> > > > for
> > > > > > that
> > > > > > > > state in the dropdownlist. The reason I chose the .xsd> > > > > > dataset
> > > > > > > > route, it easy to define relationships among tables. What do> you.> > > > > think?
> > > > > > > >
> > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > Well, basically you can have VS.NET do the grunt work for> class,> > > If
> > > > > you
> > > > > > > > > right-click on your project file, select add, then add> the> > > > select
> > > > > > > > dataset
> > > > > > > > > and use any name you like (dataset1.xsd) is fine. Now use> > > > server
> > > > > > > > > explorer to drag a few tables in the XSD and use thegenerate> this> > to> > > > add
> > > > > > > > > references and/or new fields as needed. Now, when you do> > > and
> > > > > > > compile
> > > > > > > > > your project, VS.NET will use a tool (XGEN.EXE) toit> a> > C#> > > > > file
> > > > > > > for
> > > > > > > > > you that implements a strongly typed dataset. You can usefile> > > like
> > > > > any
> > > > > > > > other
> > > > > > > > > dataset but it is also a strongly typed class with all the
> > > > > parameters
> > > > > > > that
> > > > > > > > > your tables have. You can also manually change the XSDto> or> would> > > use
> > > > > the
> > > > > > > GUI
> > > > > > > > > to build your XSD from scratch.
> > > > > > > > >
> > > > > > > > > But if all you want to do is to fill two DropDownLists I> > > > > > recommend
> > > > > > > > to
> > > > > > > > > use the Data Access Application Blocks or simple ADO.NETDataValueField.> the> > get> > dropdownlists.> > > a
> > > > > > > > DataTable
> > > > > > > > > for each table separately and attach these to the> > > > > > > > >
> > > > > > > > > One other thing: you can help the databind process to find> > > > right
> > > > > > > > columns
> > > > > > > > > to display by the user of DataTextField andhave> Country,> > For> > > > > > example,
> > > > > > > > if
> > > > > > > > > you have a DataTable with 4 columns (Company, Street,> > > > > > > CompanyID)
> > > > > > > > > and you want the ddl to display the Company as text andbut> > the> > > > > > > CompanyID
> > > > > > > > > as the value you'd do something like this:
> > > > > > > > >
> > > > > > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > > > > > MyDropDownList.DataTextField = "Company";
> > > > > > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > >
> > > > > > > > > Hope this helps!!
> > > > > > > > >
> > > > > > > > > Best regards,
> > > > > > > > >
> > > > > > > > > Marc Höppner
> > > > > > > > > NeoGeo
> > > > > > > > >
> > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > > Ok I have call the adatper.fill and databind command,autopostback> state.> > from> > > is'nt
> > > > > some
> > > > > > > > type
> > > > > > > > > of
> > > > > > > > > > code such as
> > > > Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> > > > > > > > > > "DataSet1.xsd" I have to type to get the database schema> > > > the
> > > > > > .xsd
> > > > > > > > > file
> > > > > > > > > > (I have two relate tables in my .xsd file "States" and
> > > "School".
> > > > > > when
> > > > > > > > you
> > > > > > > > > > select a state from the first dropdownlist the second
> > > > dropdownlist
> > > > > > > > suppose
> > > > > > > > > > to populate itself with the correct schools from that> > > > > > However,
> > > > > > > > the
> > > > > > > > > > first list populate with the states, (I havethe> > set> > > to
> > > > > > true,
> > > > > > > > and
> > > > > > > > > > the onchange event firing) but after the page postbackthere> over> > > state
> > > > > > > > > > dropdownlist displays System.Data.RelatedView over and> message> > > > again.
> > > > > > > > Thanks
> > > > > > > > > > for the help!
> > > > > > > > > >
> > > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in> > > > > > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > Hi Leon,
> > > > > > > > > > >
> > > > > > > > > > > configuring a typed dataset only gets you halfwayto> > > > > (assuming
> > > > > > > > that's
> > > > > > > > > > > what you are doing with the XSD). What you still needwith> > do> > > by
> > > > > > hand
> > > > > > > is
> > > > > > > > > to
> > > > > > > > > > > write some ADO.NET code to establish the connection..Fill> > the> > could> > > > > > > database
> > > > > > > > > and
> > > > > > > > > > to
> > > > > > > > > > > actually load stuff in your dataset. For example, you> > > > > define
> > > > > > a
> > > > > > > > > > > SqlDataAdapter, specify a SELECT... query and usebe> > with> > > > > your
> > > > > > > > typed
> > > > > > > > > > > DataSet as parameter (if you use SQL Server). It mayBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> a> fill> > > > little
> > > > > > > > > overkill
> > > > > > > > > > to
> > > > > > > > > > > define a typed dataset and use a DataAdapter only to>> >> > > two
> > > > > > > > > > dropdownlists.
> > > > > > > > > > > Take a look at the Data Access Application
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >> be> > > > > > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it could> you> > as> > MyConnectionString,> > > > > easy
> > > > > > as
> > > > > > > > > this
> > > > > > > > > > > (C#):
> > > > > > > > > > >
> > > > > > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet(> > > > > > > > > > > CommandType.Text, "select name, value from mytable" );
> > > > > > > > > > >
> > > > > > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > > >
> > > > > > > > > > > Note that using a dataset always has some overhead, so> (MyDataSet.xsd)> > > may
> > > > > > want
> > > > > > > to
> > > > > > > > > use
> > > > > > > > > > a
> > > > > > > > > > > SqlDataReader for performance.
> > > > > > > > > > >
> > > > > > > > > > > Best regards,
> > > > > > > > > > >
> > > > > > > > > > > Marc Hoeppner
> > > > > > > > > > > NeoGeo
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > > > > > After configuring a relation data schema>> >> > > in
> > > > > > > vs.net,
> > > > > > > > > what
> > > > > > > > > > > > code do you use to display that data within two
> > > dropdownlist
> > > > > > > > controls
> > > > > > > > > (
> > > > > > > > > > > > parent/child) in an web application?
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Leon Shaw Guest
-
Marc Hoeppner #11
Re: XSD VS.Net
Great, congrats!!
A dataset is very powerfull on the one hand, but on the other has a lot of
overhead. So you need to use it appropriately. Yes, you don't need a dataset
to fill a dropdownlist, but you also have to count other factors such as
ease of use and amount of code to type. So, I'd use something similar to the
webform1.aspx approach and make sure that the page caching is set to a long
time period if your data does not changes very often. This way you have the
ease of use as in the first sample, but the database code only gets called a
few times a time for example. So, this was selecting data.
Inserting/updating data can be done by a dataset as well, but if you only
update a few items in a form you can as well use an SPROC and send it the
values from your form directly without a dataset. If you have a larger
application and use data over and over again on different pages, it may be a
good idea to build a couple of typed datasets where appropriate and use them
both for selecting and for inserting/updating.
"Leon Shaw" <vnality@msn.com> wrote in message
news:egfNRBxSDHA.2460@TK2MSFTNGP10.phx.gbl...don't> I GOT IT TO WORK. THANKS SO MUCH, but so What you are saying is that Idataset> even have to use a dataset at all. All I really need to do is use
> sqlcommands to pull data into my form for easy selection Then use aget> to pull all the information from every form field and update the database?
> Correct
> "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> news:OcZIe3wSDHA.2128@TK2MSFTNGP12.phx.gbl...> or> > The method used in webform1.aspx should be a lot better than using typed
> > datasets in this case. Depending on your scenario you could some caching> > even load all the orders (in this case) in a dataset if all customersfiltering> > selected pretty frequently.
> >
> > If you still shoot for the typed dataset, you can start with the
> > webform2.aspx sample and go from there. You can change the sample to use
> > SPROCs instead of inline SQL, but you still will have to do thein> of> > the dataset either in T-SQL or by use of the Select or Filter functionsfor> Thanks> > DataSet/DataTable manually.
> > :)
> >
> > "Leon Shaw" <vnality@msn.com> wrote in message
> > news:OzY2jKwSDHA.1684@TK2MSFTNGP11.phx.gbl...> > > is that a better way, and more efficient way of doing it? However,> > > for all the help!
> > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > news:%23QHDd8vSDHA.3132@tk2msftngp13.phx.gbl...
> > > > Yes, you can do that!
> > > >
> > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > news:%23WQEPcvSDHA.632@tk2msftngp13.phx.gbl...
> > > > > So I should set up a store procedure in my MS SQL 2000 databaseSchoolDropDownlist?> that> > > cities
> > > > > (@StateID) and get the StateDropDownList.DataValueField and pass> > > > value
> > > > > (@StateID) to display the correct Schools in theYou> much,> > little?> > > > > Correct!
> > > > >
> > > > >
> > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...
> > > > > > I am not sure I get what you want to do. Could you elaborate a> > > > > >
> > > > > > webform2.aspx is not good going practice at all as I load all
> > > customers
> > > > > and
> > > > > > all orders into the typed dataset. I think webform1.aspx is a> > relationship> > > much
> > > > > > better implementation (faster, easier to read, easier to change,
> > > > > faster...).
> > > > > >
> > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...
> > > > > > > how do do that same code but reference the name of the> > easier> > > > such
> > > > > > as
> > > > > > > (CustomersOrders) in the DataSet1.xsd file to populate the
> > > > dropdownlist.
> > > > > > >
> > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > > > > > With regards to your application, I still think there is an> > > > way
> > > > > > to
> > > > > > > do
> > > > > > > > that. I am sure you know that by now, but just to be safe:and> > > need
> > > > be
> > > > > > > aware
> > > > > > > > that typed datasets don't write the code for you to accessyou> yourself> > > > > retrieve
> > > > > > > > data. You still need to do all the loading/saving etc.> > in> > > > > code.
> > > > > > > > Also, the databinding process for web controls does not
> > > > automatically
> > > > > > take
> > > > > > > > care of connected tables inside a dataset (typed or not),You> the> > also> > > > > have
> > > > > > to
> > > > > > > > do this yourself.
> > > > > > > >
> > > > > > > > The straight-forward approach to solving your problem (using> > > > > > Northwind
> > > > > > > > database) is attached to this post on page webform1.aspx.Server> > need> > > > to
> > > > > > edit
> > > > > > > > the connection string and the sample is done using SQLyou> or> > > > MSDE.
> > > > > > The
> > > > > > > > typed dataset version is on page webform2.aspx.
> > > > > > > >
> > > > > > > > And yes, I have remote desktop, so we can set up a time ifI'm> > > want
> > > > to
> > > > > > and
> > > > > > > > I'll give it a quick look.
> > > > > > > >
> > > > > > > >
> > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > do you have remote desktop. I would like you to see wantsetting> reference> > > doing
> > > > > for
> > > > > > > > > yourself. I have did everything you stated, and have> > > > > > multiple
> > > > > > > > > books and is yet to solve the problem. I thinking ofdo> > up> > > a
> > > > > > > > parameter
> > > > > > > > > stored procedure to get the state id to binding the right
> > > schools
> > > > > for
> > > > > > > that
> > > > > > > > > state in the dropdownlist. The reason I chose the .xsd
> > > relational
> > > > > > > dataset
> > > > > > > > > route, it easy to define relationships among tables. Whatmessage> > you> > > > > > think?
> > > > > > > > >
> > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote infor> > > > > > > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > Well, basically you can have VS.NET do the grunt workuse> > you.> > class,> > > > If
> > > > > > you
> > > > > > > > > > right-click on your project file, select add, then add> > > > > select
> > > > > > > > > dataset
> > > > > > > > > > and use any name you like (dataset1.xsd) is fine. Nowuse> toolbox> > the> > > > > server
> > > > > > > > > > explorer to drag a few tables in the XSD and use the> generate> > this> > > to
> > > > > add
> > > > > > > > > > references and/or new fields as needed. Now, when you do> > > > and
> > > > > > > > compile
> > > > > > > > > > your project, VS.NET will use a tool (XGEN.EXE) to> > a> > > C#
> > > > > > file
> > > > > > > > for
> > > > > > > > > > you that implements a strongly typed dataset. You canthe> it> > > > like
> > > > > > any
> > > > > > > > > other
> > > > > > > > > > dataset but it is also a strongly typed class with allfind> file> > > > > > parameters
> > > > > > > > that
> > > > > > > > > > your tables have. You can also manually change the XSD> to> > or> > would> > > > use
> > > > > > the
> > > > > > > > GUI
> > > > > > > > > > to build your XSD from scratch.
> > > > > > > > > >
> > > > > > > > > > But if all you want to do is to fill two DropDownLists I> > > > > > > recommend
> > > > > > > > > to
> > > > > > > > > > use the Data Access Application Blocks or simple ADO.NET> > > get
> > > > a
> > > > > > > > > DataTable
> > > > > > > > > > for each table separately and attach these to the
> > > dropdownlists.
> > > > > > > > > >
> > > > > > > > > > One other thing: you can help the databind process toschema> DataValueField.> > the> > > > > right
> > > > > > > > > columns
> > > > > > > > > > to display by the user of DataTextField and> have> > Country,> > > For
> > > > > > > example,
> > > > > > > > > if
> > > > > > > > > > you have a DataTable with 4 columns (Company, Street,> > > > > > > > CompanyID)
> > > > > > > > > > and you want the ddl to display the Company as text and> but> > > the
> > > > > > > > CompanyID
> > > > > > > > > > as the value you'd do something like this:
> > > > > > > > > >
> > > > > > > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > > > > > > MyDropDownList.DataTextField = "Company";
> > > > > > > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > >
> > > > > > > > > > Hope this helps!!
> > > > > > > > > >
> > > > > > > > > > Best regards,
> > > > > > > > > >
> > > > > > > > > > Marc Höppner
> > > > > > > > > > NeoGeo
> > > > > > > > > >
> > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > > > Ok I have call the adatper.fill and databind command,> > > > is'nt
> > > > > > some
> > > > > > > > > type
> > > > > > > > > > of
> > > > > > > > > > > code such as
> > > > > Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> > > > > > > > > > > "DataSet1.xsd" I have to type to get the databaseneed> autopostback> > state.> > > from
> > > > > the
> > > > > > > .xsd
> > > > > > > > > > file
> > > > > > > > > > > (I have two relate tables in my .xsd file "States" and
> > > > "School".
> > > > > > > when
> > > > > > > > > you
> > > > > > > > > > > select a state from the first dropdownlist the second
> > > > > dropdownlist
> > > > > > > > > suppose
> > > > > > > > > > > to populate itself with the correct schools from that> > > > > > > However,
> > > > > > > > > the
> > > > > > > > > > > first list populate with the states, (I have> the> > > set
> > > > to
> > > > > > > true,
> > > > > > > > > and
> > > > > > > > > > > the onchange event firing) but after the page postback> there> > over> > > > state
> > > > > > > > > > > dropdownlist displays System.Data.RelatedView over and> > message> > > > > again.
> > > > > > > > > Thanks
> > > > > > > > > > > for the help!
> > > > > > > > > > >
> > > > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in> > > > > > > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > > Hi Leon,
> > > > > > > > > > > >
> > > > > > > > > > > > configuring a typed dataset only gets you halfway> > > > > > (assuming
> > > > > > > > > that's
> > > > > > > > > > > > what you are doing with the XSD). What you stillyou> to> with> > > do
> > > > by
> > > > > > > hand
> > > > > > > > is
> > > > > > > > > > to
> > > > > > > > > > > > write some ADO.NET code to establish the connection> > > the
> > > > > > > > database
> > > > > > > > > > and
> > > > > > > > > > > to
> > > > > > > > > > > > actually load stuff in your dataset. For example,Blocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> .Fill> > > could
> > > > > > define
> > > > > > > a
> > > > > > > > > > > > SqlDataAdapter, specify a SELECT... query and use> be> > > with
> > > > > > your
> > > > > > > > > typed
> > > > > > > > > > > > DataSet as parameter (if you use SQL Server). It may>> > a> > fill> > > > > little
> > > > > > > > > > overkill
> > > > > > > > > > > to
> > > > > > > > > > > > define a typed dataset and use a DataAdapter only to> >> > > > two
> > > > > > > > > > > dropdownlists.
> > > > > > > > > > > > Take a look at the Data Access Application
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >could> > > > > > > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), itmytable" );> > be> > > as
> > > > > > easy
> > > > > > > as
> > > > > > > > > > this
> > > > > > > > > > > > (C#):
> > > > > > > > > > > >
> > > > > > > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet(
> > > MyConnectionString,
> > > > > > > > > > > > CommandType.Text, "select name, value fromso> > > > > > > > > > > >
> > > > > > > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > > > >
> > > > > > > > > > > > Note that using a dataset always has some overhead,>> > you> > (MyDataSet.xsd)> > > > may
> > > > > > > want
> > > > > > > > to
> > > > > > > > > > use
> > > > > > > > > > > a
> > > > > > > > > > > > SqlDataReader for performance.
> > > > > > > > > > > >
> > > > > > > > > > > > Best regards,
> > > > > > > > > > > >
> > > > > > > > > > > > Marc Hoeppner
> > > > > > > > > > > > NeoGeo
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > > > > > > After configuring a relation data schema> >> > > > in
> > > > > > > > vs.net,
> > > > > > > > > > what
> > > > > > > > > > > > > code do you use to display that data within two
> > > > dropdownlist
> > > > > > > > > controls
> > > > > > > > > > (
> > > > > > > > > > > > > parent/child) in an web application?
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Marc Hoeppner Guest
-
Leon Shaw #12
Re: XSD VS.Net
Thanks So Much! I will surely apply and share the knowledge.
"Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
news:OwIWglxSDHA.2256@TK2MSFTNGP11.phx.gbl...dataset> Great, congrats!!
>
> A dataset is very powerfull on the one hand, but on the other has a lot of
> overhead. So you need to use it appropriately. Yes, you don't need athe> to fill a dropdownlist, but you also have to count other factors such as
> ease of use and amount of code to type. So, I'd use something similar tolong> webform1.aspx approach and make sure that the page caching is set to athe> time period if your data does not changes very often. This way you havea> ease of use as in the first sample, but the database code only gets calleda> few times a time for example. So, this was selecting data.
> Inserting/updating data can be done by a dataset as well, but if you only
> update a few items in a form you can as well use an SPROC and send it the
> values from your form directly without a dataset. If you have a larger
> application and use data over and over again on different pages, it may bethem> good idea to build a couple of typed datasets where appropriate and usedatabase?> both for selecting and for inserting/updating.
>
> "Leon Shaw" <vnality@msn.com> wrote in message
> news:egfNRBxSDHA.2460@TK2MSFTNGP10.phx.gbl...> don't> > I GOT IT TO WORK. THANKS SO MUCH, but so What you are saying is that I> dataset> > even have to use a dataset at all. All I really need to do is use
> > sqlcommands to pull data into my form for easy selection Then use a> > to pull all the information from every form field and update thetyped> > Correct
> > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > news:OcZIe3wSDHA.2128@TK2MSFTNGP12.phx.gbl...> > > The method used in webform1.aspx should be a lot better than usingcaching> > > datasets in this case. Depending on your scenario you could someuse> get> > or> > > even load all the orders (in this case) in a dataset if all customers> > > selected pretty frequently.
> > >
> > > If you still shoot for the typed dataset, you can start with the
> > > webform2.aspx sample and go from there. You can change the sample tofunctions> filtering> > > SPROCs instead of inline SQL, but you still will have to do the> > of> > > the dataset either in T-SQL or by use of the Select or Filterchange,> in> for> > Thanks> > > DataSet/DataTable manually.
> > > :)
> > >
> > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > news:OzY2jKwSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > is that a better way, and more efficient way of doing it? However,> > > > for all the help!
> > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > news:%23QHDd8vSDHA.3132@tk2msftngp13.phx.gbl...
> > > > > Yes, you can do that!
> > > > >
> > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > news:%23WQEPcvSDHA.632@tk2msftngp13.phx.gbl...
> > > > > > So I should set up a store procedure in my MS SQL 2000 database> SchoolDropDownlist?> > that> > > > cities
> > > > > > (@StateID) and get the StateDropDownList.DataValueField and pass> > > > > value
> > > > > > (@StateID) to display the correct Schools in the> > much,> > > > > > Correct!
> > > > > >
> > > > > >
> > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...
> > > > > > > I am not sure I get what you want to do. Could you elaborate a
> > > little?
> > > > > > >
> > > > > > > webform2.aspx is not good going practice at all as I load all
> > > > customers
> > > > > > and
> > > > > > > all orders into the typed dataset. I think webform1.aspx is a> > > > much
> > > > > > > better implementation (faster, easier to read, easier toan> > > > > > faster...).
> > > > > > >
> > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...
> > > > > > > > how do do that same code but reference the name of the
> > > relationship
> > > > > such
> > > > > > > as
> > > > > > > > (CustomersOrders) in the DataSet1.xsd file to populate the
> > > > > dropdownlist.
> > > > > > > >
> > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > > > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > With regards to your application, I still think there is(using> You> > > easier
> > > > > way
> > > > > > > to
> > > > > > > > do
> > > > > > > > > that. I am sure you know that by now, but just to be safe:> and> > > > need
> > > > > be
> > > > > > > > aware
> > > > > > > > > that typed datasets don't write the code for you to access> you> > yourself> > > > > > retrieve
> > > > > > > > > data. You still need to do all the loading/saving etc.> > > in
> > > > > > code.
> > > > > > > > > Also, the databinding process for web controls does not
> > > > > automatically
> > > > > > > take
> > > > > > > > > care of connected tables inside a dataset (typed or not),> > > also
> > > > > > have
> > > > > > > to
> > > > > > > > > do this yourself.
> > > > > > > > >
> > > > > > > > > The straight-forward approach to solving your problemright> You> > the> > > > > > > Northwind
> > > > > > > > > database) is attached to this post on page webform1.aspx.> Server> > > need
> > > > > to
> > > > > > > edit
> > > > > > > > > the connection string and the sample is done using SQL> you> > or> > > > > MSDE.
> > > > > > > The
> > > > > > > > > typed dataset version is on page webform2.aspx.
> > > > > > > > >
> > > > > > > > > And yes, I have remote desktop, so we can set up a time if> I'm> > > > want
> > > > > to
> > > > > > > and
> > > > > > > > > I'll give it a quick look.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > > do you have remote desktop. I would like you to see want> setting> > reference> > > > doing
> > > > > > for
> > > > > > > > > > yourself. I have did everything you stated, and have> > > > > > > multiple
> > > > > > > > > > books and is yet to solve the problem. I thinking of> > > up
> > > > a
> > > > > > > > > parameter
> > > > > > > > > > stored procedure to get the state id to binding theWhat> > > > schools
> > > > > > for
> > > > > > > > that
> > > > > > > > > > state in the dropdownlist. The reason I chose the .xsd
> > > > relational
> > > > > > > > dataset
> > > > > > > > > > route, it easy to define relationships among tables.do> do> message> > > you
> > > > > > > think?
> > > > > > > > > >
> > > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in> for> > > > > > > > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > Well, basically you can have VS.NET do the grunt work> use> > > you.
> > > > > If
> > > > > > > you
> > > > > > > > > > > right-click on your project file, select add, then add
> > > class,
> > > > > > select
> > > > > > > > > > dataset
> > > > > > > > > > > and use any name you like (dataset1.xsd) is fine. Now> > toolbox> > > the
> > > > > > server
> > > > > > > > > > > explorer to drag a few tables in the XSD and use the> > > > to
> > > > > > add
> > > > > > > > > > > references and/or new fields as needed. Now, when youI> use> > generate> > > this
> > > > > and
> > > > > > > > > compile
> > > > > > > > > > > your project, VS.NET will use a tool (XGEN.EXE) to> > > a
> > > > C#
> > > > > > > file
> > > > > > > > > for
> > > > > > > > > > > you that implements a strongly typed dataset. You can> the> > it> > > > > like
> > > > > > > any
> > > > > > > > > > other
> > > > > > > > > > > dataset but it is also a strongly typed class with all> > file> > > > > > > parameters
> > > > > > > > > that
> > > > > > > > > > > your tables have. You can also manually change the XSD> > > or
> > > > > use
> > > > > > > the
> > > > > > > > > GUI
> > > > > > > > > > > to build your XSD from scratch.
> > > > > > > > > > >
> > > > > > > > > > > But if all you want to do is to fill two DropDownListsADO.NET> > > would
> > > > > > > > recommend
> > > > > > > > > > to
> > > > > > > > > > > use the Data Access Application Blocks or simpleand> find> > to> > > > get
> > > > > a
> > > > > > > > > > DataTable
> > > > > > > > > > > for each table separately and attach these to the
> > > > dropdownlists.
> > > > > > > > > > >
> > > > > > > > > > > One other thing: you can help the databind process to> > DataValueField.> > > the
> > > > > > right
> > > > > > > > > > columns
> > > > > > > > > > > to display by the user of DataTextField and> > > > For
> > > > > > > > example,
> > > > > > > > > > if
> > > > > > > > > > > you have a DataTable with 4 columns (Company, Street,
> > > Country,
> > > > > > > > > CompanyID)
> > > > > > > > > > > and you want the ddl to display the Company as textcommand,> > have> > > > the
> > > > > > > > > CompanyID
> > > > > > > > > > > as the value you'd do something like this:
> > > > > > > > > > >
> > > > > > > > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > > > > > > > MyDropDownList.DataTextField = "Company";
> > > > > > > > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > > >
> > > > > > > > > > > Hope this helps!!
> > > > > > > > > > >
> > > > > > > > > > > Best regards,
> > > > > > > > > > >
> > > > > > > > > > > Marc Höppner
> > > > > > > > > > > NeoGeo
> > > > > > > > > > >
> > > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > > > > Ok I have call the adatper.fill and databindand> schema> > but> > > > > is'nt
> > > > > > > some
> > > > > > > > > > type
> > > > > > > > > > > of
> > > > > > > > > > > > code such as
> > > > > > Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> > > > > > > > > > > > "DataSet1.xsd" I have to type to get the database> > > > from
> > > > > > the
> > > > > > > > .xsd
> > > > > > > > > > > file
> > > > > > > > > > > > (I have two relate tables in my .xsd file "States"second> > > > > "School".
> > > > > > > > when
> > > > > > > > > > you
> > > > > > > > > > > > select a state from the first dropdownlist thethat> > > > > > dropdownlist
> > > > > > > > > > suppose
> > > > > > > > > > > > to populate itself with the correct schools frompostback> > autopostback> > > state.
> > > > > > > > However,
> > > > > > > > > > the
> > > > > > > > > > > > first list populate with the states, (I have> > > > set
> > > > > to
> > > > > > > > true,
> > > > > > > > > > and
> > > > > > > > > > > > the onchange event firing) but after the pageand> > the> > > > > state
> > > > > > > > > > > > dropdownlist displays System.Data.RelatedView overconnection> need> > there> > > over
> > > > > > again.
> > > > > > > > > > Thanks
> > > > > > > > > > > > for the help!
> > > > > > > > > > > >
> > > > > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in
> > > message
> > > > > > > > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > > > Hi Leon,
> > > > > > > > > > > > >
> > > > > > > > > > > > > configuring a typed dataset only gets you halfway> > > > > > > (assuming
> > > > > > > > > > that's
> > > > > > > > > > > > > what you are doing with the XSD). What you still> > to> > > > do
> > > > > by
> > > > > > > > hand
> > > > > > > > > is
> > > > > > > > > > > to
> > > > > > > > > > > > > write some ADO.NET code to establish themay> you> > with> > > > the
> > > > > > > > > database
> > > > > > > > > > > and
> > > > > > > > > > > > to
> > > > > > > > > > > > > actually load stuff in your dataset. For example,> > .Fill> > > > could
> > > > > > > define
> > > > > > > > a
> > > > > > > > > > > > > SqlDataAdapter, specify a SELECT... query and use> > > > with
> > > > > > > your
> > > > > > > > > > typed
> > > > > > > > > > > > > DataSet as parameter (if you use SQL Server). Itto> > be> > > a
> > > > > > little
> > > > > > > > > > > overkill
> > > > > > > > > > > > to
> > > > > > > > > > > > > define a typed dataset and use a DataAdapter onlyBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]>> >> > > fill
> > > > > two
> > > > > > > > > > > > dropdownlists.
> > > > > > > > > > > > > Take a look at the Data Access Application
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >overhead,> could> > > > > > > > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it> mytable" );> > > be
> > > > as
> > > > > > > easy
> > > > > > > > as
> > > > > > > > > > > this
> > > > > > > > > > > > > (C#):
> > > > > > > > > > > > >
> > > > > > > > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet(
> > > > MyConnectionString,
> > > > > > > > > > > > > CommandType.Text, "select name, value from> > > > > > > > > > > > >
> > > > > > > > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > > > > >
> > > > > > > > > > > > > Note that using a dataset always has some> so>> >> > > you
> > > > > may
> > > > > > > > want
> > > > > > > > > to
> > > > > > > > > > > use
> > > > > > > > > > > > a
> > > > > > > > > > > > > SqlDataReader for performance.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Best regards,
> > > > > > > > > > > > >
> > > > > > > > > > > > > Marc Hoeppner
> > > > > > > > > > > > > NeoGeo
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > > > > > > > After configuring a relation data schema
> > > (MyDataSet.xsd)
> > > > > in
> > > > > > > > > vs.net,
> > > > > > > > > > > what
> > > > > > > > > > > > > > code do you use to display that data within two
> > > > > dropdownlist
> > > > > > > > > > controls
> > > > > > > > > > > (
> > > > > > > > > > > > > > parent/child) in an web application?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Leon Shaw Guest
-
Marc Hoeppner #13
Re: XSD VS.Net
Excellent, glad to be of help!
"Leon Shaw" <vnality@msn.com> wrote in message
news:OumP7$xSDHA.2276@TK2MSFTNGP10.phx.gbl...of> Thanks So Much! I will surely apply and share the knowledge.
> "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> news:OwIWglxSDHA.2256@TK2MSFTNGP11.phx.gbl...> > Great, congrats!!
> >
> > A dataset is very powerfull on the one hand, but on the other has a lotcalled> dataset> > overhead. So you need to use it appropriately. Yes, you don't need a> the> > to fill a dropdownlist, but you also have to count other factors such as
> > ease of use and amount of code to type. So, I'd use something similar to> long> > webform1.aspx approach and make sure that the page caching is set to a> the> > time period if your data does not changes very often. This way you have> > ease of use as in the first sample, but the database code only getsonly> a> > few times a time for example. So, this was selecting data.
> > Inserting/updating data can be done by a dataset as well, but if youthe> > update a few items in a form you can as well use an SPROC and send itbe> > values from your form directly without a dataset. If you have a larger
> > application and use data over and over again on different pages, it maycustomers> a> them> > good idea to build a couple of typed datasets where appropriate and use> database?> > both for selecting and for inserting/updating.
> >
> > "Leon Shaw" <vnality@msn.com> wrote in message
> > news:egfNRBxSDHA.2460@TK2MSFTNGP10.phx.gbl...> > don't> > > I GOT IT TO WORK. THANKS SO MUCH, but so What you are saying is that I> > dataset> > > even have to use a dataset at all. All I really need to do is use
> > > sqlcommands to pull data into my form for easy selection Then use a> > > to pull all the information from every form field and update the> typed> > > Correct
> > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > news:OcZIe3wSDHA.2128@TK2MSFTNGP12.phx.gbl...
> > > > The method used in webform1.aspx should be a lot better than using> caching> > > > datasets in this case. Depending on your scenario you could some> > > or
> > > > even load all the orders (in this case) in a dataset if alldatabase> use> > get> > > > selected pretty frequently.
> > > >
> > > > If you still shoot for the typed dataset, you can start with the
> > > > webform2.aspx sample and go from there. You can change the sample to> functions> > filtering> > > > SPROCs instead of inline SQL, but you still will have to do the> > > of
> > > > the dataset either in T-SQL or by use of the Select or Filter> > in> > > > DataSet/DataTable manually.
> > > > :)
> > > >
> > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > news:OzY2jKwSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > > is that a better way, and more efficient way of doing it? However,
> > > Thanks
> > > > > for all the help!
> > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > news:%23QHDd8vSDHA.3132@tk2msftngp13.phx.gbl...
> > > > > > Yes, you can do that!
> > > > > >
> > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > news:%23WQEPcvSDHA.632@tk2msftngp13.phx.gbl...
> > > > > > > So I should set up a store procedure in my MS SQL 2000pass> > for> > > > > cities
> > > > > > > (@StateID) and get the StateDropDownList.DataValueField anda> > SchoolDropDownlist?> > > that
> > > > > > value
> > > > > > > (@StateID) to display the correct Schools in the> > > > > > > Correct!
> > > > > > >
> > > > > > >
> > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
> > > > > > > news:uJ6XvKvSDHA.2852@tk2msftngp13.phx.gbl...
> > > > > > > > I am not sure I get what you want to do. Could you elaborateall> > > > little?
> > > > > > > >
> > > > > > > > webform2.aspx is not good going practice at all as I loada> > > > > customers
> > > > > > > and
> > > > > > > > all orders into the typed dataset. I think webform1.aspx ismessage> change,> > > much,
> > > > > much
> > > > > > > > better implementation (faster, easier to read, easier to> > > > > > > faster...).
> > > > > > > >
> > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > news:%23FTMkTtSDHA.2148@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > how do do that same code but reference the name of the
> > > > relationship
> > > > > > such
> > > > > > > > as
> > > > > > > > > (CustomersOrders) in the DataSet1.xsd file to populate the
> > > > > > dropdownlist.
> > > > > > > > >
> > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote insafe:> an> > > > > > > > > news:esvEU3qSDHA.1684@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > With regards to your application, I still think there is> > > > easier
> > > > > > way
> > > > > > > > to
> > > > > > > > > do
> > > > > > > > > > that. I am sure you know that by now, but just to beaccess> > You> > > > > need
> > > > > > be
> > > > > > > > > aware
> > > > > > > > > > that typed datasets don't write the code for you tonot),> > and> > > > > > > retrieve
> > > > > > > > > > data. You still need to do all the loading/saving etc.
> > > yourself
> > > > in
> > > > > > > code.
> > > > > > > > > > Also, the databinding process for web controls does not
> > > > > > automatically
> > > > > > > > take
> > > > > > > > > > care of connected tables inside a dataset (typed orwebform1.aspx.> (using> > you> > > > also
> > > > > > > have
> > > > > > > > to
> > > > > > > > > > do this yourself.
> > > > > > > > > >
> > > > > > > > > > The straight-forward approach to solving your problem> > > the
> > > > > > > > Northwind
> > > > > > > > > > database) is attached to this post on pageif> > You> > Server> > > > need
> > > > > > to
> > > > > > > > edit
> > > > > > > > > > the connection string and the sample is done using SQL> > > or
> > > > > > MSDE.
> > > > > > > > The
> > > > > > > > > > typed dataset version is on page webform2.aspx.
> > > > > > > > > >
> > > > > > > > > > And yes, I have remote desktop, so we can set up a timewant> > you> > > > > want
> > > > > > to
> > > > > > > > and
> > > > > > > > > > I'll give it a quick look.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > news:eolD3IoSDHA.1916@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > > > do you have remote desktop. I would like you to seework> right> > I'm> > setting> > > > > doing
> > > > > > > for
> > > > > > > > > > > yourself. I have did everything you stated, and have
> > > reference
> > > > > > > > multiple
> > > > > > > > > > > books and is yet to solve the problem. I thinking of> > > > up
> > > > > a
> > > > > > > > > > parameter
> > > > > > > > > > > stored procedure to get the state id to binding the> What> > > > > schools
> > > > > > > for
> > > > > > > > > that
> > > > > > > > > > > state in the dropdownlist. The reason I chose the .xsd
> > > > > relational
> > > > > > > > > dataset
> > > > > > > > > > > route, it easy to define relationships among tables.> > do> > message> > > > you
> > > > > > > > think?
> > > > > > > > > > >
> > > > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in> > > > > > > > > > > news:OcWOLGlSDHA.1920@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > > Well, basically you can have VS.NET do the gruntadd> > for> > > > you.
> > > > > > If
> > > > > > > > you
> > > > > > > > > > > > right-click on your project file, select add, thenNow> > > > class,
> > > > > > > select
> > > > > > > > > > > dataset
> > > > > > > > > > > > and use any name you like (dataset1.xsd) is fine.you> > use> > > > the
> > > > > > > server
> > > > > > > > > > > > explorer to drag a few tables in the XSD and use the
> > > toolbox
> > > > > to
> > > > > > > add
> > > > > > > > > > > > references and/or new fields as needed. Now, whencan> do> > > > this
> > > > > > and
> > > > > > > > > > compile
> > > > > > > > > > > > your project, VS.NET will use a tool (XGEN.EXE) to
> > > generate
> > > > a
> > > > > C#
> > > > > > > > file
> > > > > > > > > > for
> > > > > > > > > > > > you that implements a strongly typed dataset. Youall> > use> > > it
> > > > > > like
> > > > > > > > any
> > > > > > > > > > > other
> > > > > > > > > > > > dataset but it is also a strongly typed class withXSD> > the> > > > > > > > parameters
> > > > > > > > > > that
> > > > > > > > > > > > your tables have. You can also manually change theDropDownLists> > > file
> > > > or
> > > > > > use
> > > > > > > > the
> > > > > > > > > > GUI
> > > > > > > > > > > > to build your XSD from scratch.
> > > > > > > > > > > >
> > > > > > > > > > > > But if all you want to do is to fill twoto> I> ADO.NET> > > > would
> > > > > > > > > recommend
> > > > > > > > > > > to
> > > > > > > > > > > > use the Data Access Application Blocks or simple> > > to
> > > > > get
> > > > > > a
> > > > > > > > > > > DataTable
> > > > > > > > > > > > for each table separately and attach these to the
> > > > > dropdownlists.
> > > > > > > > > > > >
> > > > > > > > > > > > One other thing: you can help the databind processStreet,> > find> > > > the
> > > > > > > right
> > > > > > > > > > > columns
> > > > > > > > > > > > to display by the user of DataTextField and
> > > DataValueField.
> > > > > For
> > > > > > > > > example,
> > > > > > > > > > > if
> > > > > > > > > > > > you have a DataTable with 4 columns (Company,in> and> > > > Country,
> > > > > > > > > > CompanyID)
> > > > > > > > > > > > and you want the ddl to display the Company as text> command,> > > have
> > > > > the
> > > > > > > > > > CompanyID
> > > > > > > > > > > > as the value you'd do something like this:
> > > > > > > > > > > >
> > > > > > > > > > > > MyDropDownList.DataSource = MyDataTable;
> > > > > > > > > > > > MyDropDownList.DataTextField = "Company";
> > > > > > > > > > > > MyDropDownList.DataValueField = "CompanyID";
> > > > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > > > >
> > > > > > > > > > > > Hope this helps!!
> > > > > > > > > > > >
> > > > > > > > > > > > Best regards,
> > > > > > > > > > > >
> > > > > > > > > > > > Marc Höppner
> > > > > > > > > > > > NeoGeo
> > > > > > > > > > > >
> > > > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > > > news:%23GrrRwkSDHA.1320@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > > > > > Ok I have call the adatper.fill and databind> and> > schema> > > but
> > > > > > is'nt
> > > > > > > > some
> > > > > > > > > > > type
> > > > > > > > > > > > of
> > > > > > > > > > > > > code such as
> > > > > > > Me.DataSet1.WriteXmlSchema(Me.Request.ApplicationP ath
> > > > > > > > > > > > > "DataSet1.xsd" I have to type to get the database> > > > > from
> > > > > > > the
> > > > > > > > > .xsd
> > > > > > > > > > > > file
> > > > > > > > > > > > > (I have two relate tables in my .xsd file "States"> second> > > > > > "School".
> > > > > > > > > when
> > > > > > > > > > > you
> > > > > > > > > > > > > select a state from the first dropdownlist the> that> > > > > > > dropdownlist
> > > > > > > > > > > suppose
> > > > > > > > > > > > > to populate itself with the correct schools from> postback> > > > state.
> > > > > > > > > However,
> > > > > > > > > > > the
> > > > > > > > > > > > > first list populate with the states, (I have
> > > autopostback
> > > > > set
> > > > > > to
> > > > > > > > > true,
> > > > > > > > > > > and
> > > > > > > > > > > > > the onchange event firing) but after the page> and> > > the
> > > > > > state
> > > > > > > > > > > > > dropdownlist displays System.Data.RelatedView over> > > > over
> > > > > > > again.
> > > > > > > > > > > Thanks
> > > > > > > > > > > > > for the help!
> > > > > > > > > > > > >
> > > > > > > > > > > > > "Marc Hoeppner" <marchoeppner@hotmail.com> wrotehalfway> > > > message
> > > > > > > > > > > > > news:OxAy7dkSDHA.2020@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > > > > Hi Leon,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > configuring a typed dataset only gets youexample,> connection> > need> > > there
> > > > > > > > (assuming
> > > > > > > > > > > that's
> > > > > > > > > > > > > > what you are doing with the XSD). What you still> > > to
> > > > > do
> > > > > > by
> > > > > > > > > hand
> > > > > > > > > > is
> > > > > > > > > > > > to
> > > > > > > > > > > > > > write some ADO.NET code to establish the> > > with
> > > > > the
> > > > > > > > > > database
> > > > > > > > > > > > and
> > > > > > > > > > > > > to
> > > > > > > > > > > > > > actually load stuff in your dataset. Foruse> > you> > > > > could
> > > > > > > > define
> > > > > > > > > a
> > > > > > > > > > > > > > SqlDataAdapter, specify a SELECT... query andonly> may> > > .Fill
> > > > > with
> > > > > > > > your
> > > > > > > > > > > typed
> > > > > > > > > > > > > > DataSet as parameter (if you use SQL Server). It> > > be
> > > > a
> > > > > > > little
> > > > > > > > > > > > overkill
> > > > > > > > > > > > > to
> > > > > > > > > > > > > > define a typed dataset and use a DataAdapterBlocks([url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx[/url]> to>> >> > > > fill
> > > > > > two
> > > > > > > > > > > > > dropdownlists.
> > > > > > > > > > > > > > Take a look at the Data Access Application
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >two> overhead,> > could> > > > > > > > > > > > > > ?pull=/library/en-us/dnbda/html/daab-rm.asp), it> > mytable" );> > > > be
> > > > > as
> > > > > > > > easy
> > > > > > > > > as
> > > > > > > > > > > > this
> > > > > > > > > > > > > > (C#):
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > DataSet MyDs = SqlHelper.ExecuteDataSet(
> > > > > MyConnectionString,
> > > > > > > > > > > > > > CommandType.Text, "select name, value from> > > > > > > > > > > > > >
> > > > > > > > > > > > > > MyDropDownList.DataSource = MyDs.Tables[0];
> > > > > > > > > > > > > > MyDropDownList.DataTextField = "name";
> > > > > > > > > > > > > > MyDropDownList.DataValueField = "value";
> > > > > > > > > > > > > > MyDropDownList.DataBind();
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Note that using a dataset always has some> > so> > > > you
> > > > > > may
> > > > > > > > > want
> > > > > > > > > > to
> > > > > > > > > > > > use
> > > > > > > > > > > > > a
> > > > > > > > > > > > > > SqlDataReader for performance.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Best regards,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Marc Hoeppner
> > > > > > > > > > > > > > NeoGeo
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > "Leon Shaw" <vnality@msn.com> wrote in message
> > > > > > > > > > > > > > news:OXK2hxjSDHA.3796@tk2msftngp13.phx.gbl...
> > > > > > > > > > > > > > > After configuring a relation data schema
> > > > (MyDataSet.xsd)
> > > > > > in
> > > > > > > > > > vs.net,
> > > > > > > > > > > > what
> > > > > > > > > > > > > > > code do you use to display that data within>> >> > > > > > dropdownlist
> > > > > > > > > > > controls
> > > > > > > > > > > > (
> > > > > > > > > > > > > > > parent/child) in an web application?
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Marc Hoeppner Guest



Reply With Quote

