ASP.NET web application with ADO.NET

  • Thread starter Thread starter Ben Taylor
  • Start date Start date
B

Ben Taylor

Hi
I am trying to build, more for a learning project than anything, an ASP.NET
web application in C# that will run on my local machine, which has now
successully got IIS installed on it (XP pro).
In the first instance, I initially want it to be able to get data from MSDE
via ADO.NET, and display it, hopefully in the form of a graph. Can it do
this?
I am mainly experienced in VB6 and a little bit of C++, but I've not really
done much with C# and I don't really know how to create web applications,
hence my want to gain experience in this field. Now I know I could easily do
what I want it to be able to display in VB6, and more. But I want to get an
ASP page working.
Where do I start?
 
crack open visual studio and instead of choosing windows forms choose web
applications. the rest is basically the same. clicks map to events etc.

As your first project you are really attempting to bite off too much. try
something smaller and work your way up. Graphs get complicated real fast. If
you insist, you can use the Office web component library to generate graphs
clientside, or you can build the graph out on the server and stream it to
the client. The latter is easier but doesn't provide interactivity. If you
google for graphs OWC, you will find a lot of hits on there.

A webpage cannot normally access system objects so you cannot without a
degree of effort, play with fonts pens and brushes from a web page to create
a graph like you would in vb. It works a little differently than the windows
side mainly because of permissions issues. Web pages are configured to run
with minimal permissions.

good luck
 
Thanks for the advice Alvin...
Basically, I DO insist. I work in a data-analysis type role but it's
basically just Excel and SQL server and they laugh if you suggest that we
sit down and design something before starting to code it - as there's not
much design to be done - hence there's not really much strategy there or web
experience to be got, I don't know why they don't want a web server. Maybe
it's political reasons so they don't have to pay me more and so I won't
acquire the skills necessary to jump ship. But I want to be able to say I am
expert in data analysis and database programming, AND creation of ASP pages
and web development involving the data I can generate. This, I believe, is
what I am going to need to do to get myself out of the 'data-on-demand',
design-less rut I appear to be finding myself in.
So, I've decided that if I'm going to be able to say I've got all this web
experience from doing it at home, I want to be able to push forward a sample
project and possibly even some generic custom libraries in order to be able
to prove to the first rung of the ladder what I'm made of. This is going to
have to be more than the hello-world type project, but generic enough for
them to understand it and for it to look good, and mainly so I can get it
working first, and then build on its functionality once I know its
limitations.
Enter the OWC.....
I decided that creating client-side graphs in the way that I would would
either be a piece of piss or not teach me enough new skills - they'd have to
have Office or whatever charting component I was using installed - so I
might aswell just write a DHTML application, ActiveX document or simply bung
a chart control into FrontPage or InterDev and write loads of VBScript.
I then searched for 'server-side charting' on Google and it came up with an
example of using the OWC to create server side charts, it basically just
adds some random data, then uses the ExportImage (or something) method to
save it off as a gif, it then just calls Response.Write "<img src
='<Locationofthegif'>".
This was pathetic, however - as I couldn't get the OWC to display any more
than a pair of axes even when early bound on a VB form, let alone on an ASP
page. That was even with the code exactly as written in the example.
So I've decided to write my own version as an ActiveX DLL that will use as
its base object the VB PictureBox control (on a hidden form), and have full
functionality for taking a dataset (as a recordset) and saving off a chart
as a bitmap. I'll then have this run by a VB6 IIS application. Shame about
the .NET, but then I didn't have much faith in it to lose, so I won't mourn
TOO much, even though it is taking off rapidly in terms of commercial use.
My custom chart classes will be very generic and might even sell, based on
simplicity and (hopefully) eventual robustness - even though it may not be
the fastest way of doing things, but if you wanted speed then you could use
client-side technologies - placing less load on the web server, which I can
easiliy already do.

Thanks for your guidance, and any more you can offer will be greatly
appreciated....
Thanks
Ben
 
That's a good attitude. It's the right attitude to get you to be more
marketable and that cannot possibly hurt. If you can get a good sample
working, it will convince them. I'm sure of it. Especially if you can show
more features developed in less time equating to more money saved.
This was pathetic, however - as I couldn't get the OWC to display any more
than a pair of axes even when early bound on a VB form, let alone on an
ASP

That's not correct, though. You have the ability to plot as much as 5 series
on one graph, colored and individualized. It's extremely powerful, allowing
you 3D graphing and about 30 different kinds of charts. The idea behind the
OWC is simply that you do not have to spend time developing and testing a
library to aid in chart design.

If you would like to build your own then, here are a few pointers:
You'd have to use GDI+ which is a graphics engine borrowed from windows XP.
It's a set of managed classes which allows access to windows drawing
resources. Here is a bare bones example

//draw a rectangle on screen
Graphics g = Graphics.FromImage(new Bitmap(100,100))
g.DrawRectangle(new Pen(Color.Red)),0,0,20,20);
g.FillRectangle(new SolidBrush(Color.Green);,2,2,15,15);

You have a couple of issues here to be concerned with. Asp.Net file
permission adjustments for writing the image to disk. Resource deallocation.
These are windows unmanaged resources, you will need to correctly dispose of
them to eliminate memory leaks. There are many experts in here who can help
you with these issues as well. So if you have the time, and are willing to
post here, you can get it done, learn a lot, and have a ball of a time doing
it.

good luck.
 
Back
Top