Data Access with ASP+
I've been reading through a lot of the samples and the SDK for how to do
data access with ASP+. It seems like all the examples use the "DataSet"
class and then bind to a server control.
All the pages that I've ever coded never use binding because that was always
a big no-no for performance. Is this not the case with ADO+/ASP+? What if
I want to display a UI that doesn't use server controls (ie, asp+ and
client-side spaghetti code mixed)?
I did find some C# code in the SDK which seems to be the way that I'm more
used to, however most examples use a server control. Below is what the SDK
says for doing data access with ASP+: Below that is an example I found and
modified on how to do data access with C# without using controls.
---
The general procedure for accessing databases from ASP+ is as follows:
1.. Connect to the database using the SQLDataSetCommand.
2.. Fill a new DataSet using SQLDataSetCommand.FillDataSet.
3.. Set up a new DataView for the desired table.
4.. Bind a server control such as DataGrid to the DataView.
---
// Example not using a control
customerDataSet myCustDS = new customerDataSet();
SQLDataSetCommand myDSCommand = new SQLDataSetCommand("SELECT * FROM
Customers", "server=localhost;uid=sa;pwd=;database=northwind");
myDSCommand.FillDataSet(myCustDS, "Customers");
foreach(customersRow myCustomer in myCustDS.customers)
{
Response.write(myCustomer.CustomerID.ToString());
}
[1572 byte] By [
Greg Huber] at [2007-11-9 16:23:46]

# 1 Re: Data Access with ASP+
You can do your own UI and your way to present data. However, server site
controls (web controls) let you program UI without involving JavaScript/JScript
and moreover, they have lots of properties and methods to save you lots of
programming efforts. For instance, you can customize DataGrid to do paging,
template or triger events, etc.
M. Yang
"Greg Huber" <ghuber@NOSPAMPLEASEhcr-manorcare.com> wrote:
>I've been reading through a lot of the samples and the SDK for how to do
>data access with ASP+. It seems like all the examples use the "DataSet"
>class and then bind to a server control.
>
>All the pages that I've ever coded never use binding because that was always
>a big no-no for performance. Is this not the case with ADO+/ASP+? What
if
>I want to display a UI that doesn't use server controls (ie, asp+ and
>client-side spaghetti code mixed)?
>
>I did find some C# code in the SDK which seems to be the way that I'm more
>used to, however most examples use a server control. Below is what the SDK
>says for doing data access with ASP+: Below that is an example I found
and
>modified on how to do data access with C# without using controls.
>---
>
>The general procedure for accessing databases from ASP+ is as follows:
>
> 1.. Connect to the database using the SQLDataSetCommand.
> 2.. Fill a new DataSet using SQLDataSetCommand.FillDataSet.
> 3.. Set up a new DataView for the desired table.
> 4.. Bind a server control such as DataGrid to the DataView.
>---
>// Example not using a control
>
>customerDataSet myCustDS = new customerDataSet();
>SQLDataSetCommand myDSCommand = new SQLDataSetCommand("SELECT * FROM
>Customers", "server=localhost;uid=sa;pwd=;database=northwind");
>
>myDSCommand.FillDataSet(myCustDS, "Customers");
>
>foreach(customersRow myCustomer in myCustDS.customers)
>{
> Response.write(myCustomer.CustomerID.ToString());
>}
>
>
>
>
# 2 Re: Data Access with ASP+
Not having to code with JavaScript is nice, but at what sacrifice.. Having
to make a trip to the server each time (even if state is auto-maintained as
it is in ASP+)? The applications that I've developed do all the processing
of the server in the background (hidden frame, updates form controls from
that as well) so a web application looks a lot like any other application.
What if I want to do simple validation..Say I want a user to enter a date
that is later than todays date, and not allow them to continue if they do
so. That means now I have to reload (or "blink" as non-tech users call it)
the screen to check that field.
I guess an alternative would be to create my own control that renders client
side java script... But that seems to be defeating the purpose. Bottom
line is to have a quality application you are going to need to do some
client validation, or have some really fat bandwidth so the users don't
notice the reloads. What user wants to wait for a page to reload every time
you fill in something? I think the data grid controls and what not are
excellent for "quick and dirty" database maintanence, but when I want to
write a quality application I need to put some validation in.
Just my thoughts..
Greg
"m. yang" <myang@foxinternet.net> wrote in message
news:3999a38f$1@news.dev-archive.com...
>
> You can do your own UI and your way to present data. However, server site
> controls (web controls) let you program UI without involving
JavaScript/JScript
> and moreover, they have lots of properties and methods to save you lots of
> programming efforts. For instance, you can customize DataGrid to do
paging,
> template or triger events, etc.
>
> M. Yang
>
>
> "Greg Huber" <ghuber@NOSPAMPLEASEhcr-manorcare.com> wrote:
> >I've been reading through a lot of the samples and the SDK for how to do
> >data access with ASP+. It seems like all the examples use the "DataSet"
> >class and then bind to a server control.
> >
> >All the pages that I've ever coded never use binding because that was
always
> >a big no-no for performance. Is this not the case with ADO+/ASP+? What
> if
> >I want to display a UI that doesn't use server controls (ie, asp+ and
> >client-side spaghetti code mixed)?
> >
> >I did find some C# code in the SDK which seems to be the way that I'm
more
> >used to, however most examples use a server control. Below is what the
SDK
> >says for doing data access with ASP+: Below that is an example I found
> and
> >modified on how to do data access with C# without using controls.
> >---
> >
> >The general procedure for accessing databases from ASP+ is as follows:
> >
> > 1.. Connect to the database using the SQLDataSetCommand.
> > 2.. Fill a new DataSet using SQLDataSetCommand.FillDataSet.
> > 3.. Set up a new DataView for the desired table.
> > 4.. Bind a server control such as DataGrid to the DataView.
> >---
> >// Example not using a control
> >
> >customerDataSet myCustDS = new customerDataSet();
> >SQLDataSetCommand myDSCommand = new SQLDataSetCommand("SELECT * FROM
> >Customers", "server=localhost;uid=sa;pwd=;database=northwind");
> >
> >myDSCommand.FillDataSet(myCustDS, "Customers");
> >
> >foreach(customersRow myCustomer in myCustDS.customers)
> >{
> > Response.write(myCustomer.CustomerID.ToString());
> >}
> >
> >
> >
> >
>
# 3 Re: Data Access with ASP+
There are validation controls, which will generate javascript for 'uplevel'
browsers and do the validation client side. However, I am having trouble
getting these to work inside an itemtemplate. It seems like the validation
controls are evaluated at a different time, and don't have the same namingcontainer
as everything else in the itemtemplate. I haven't yet gotten them to work
right (about 4 hours of effort on just that now).
Steve at 2007-11-11 23:28:25 >
