This sample shows how you can use ASP.NET to query a database table for multiple search terms. Whether you want the results that match any of the search terms or you just want results that match all of them, the process really isn't as hard as you might think.
Last week while I was talking with a friend of mine, he asked me a couple questions and then told me when I could expect my economic stimulus payment. This sample does the same thing. It's nothing fancy, but it does illustrate some basic form handling, conditional branching, and a good use of a Select Case statement. Give it a try... hopefully your payment is coming soon!
Why do people insist on using mm-dd-year or dd-mm-year when creating
log files? Are you really trying to see what happened on the same
month of every year or the same day of every month? You might want
to try this alternative, which when sorted numerically actually puts
the files into chronological order.
This sample shows how you can query a database table for multiple search terms.
Whether you want the results that match any of the search terms or you just
want results that match all of them, the process really isn't as hard as you might think.
When people talk about new features in Visual Studio 2008, you'll usually
hear them talk about improved Javascript Intellisense and debugging, amazing
advances in CSS support, huge gains in the IDE's responsiveness, and the fact that Microsoft
has given us mere mortals access to the actual source code of the .NET Framework libraries.
But for the working developer, all those pale in comparison to a simple little
feature called multi-targeting.
I recently started getting some odd characters appearing when
working with an old classic ASP application. I'd been using the
same scripts for years and while I knew that nothing in the
application had changed, we'd recently started using Visual Studio
2008 to create the application's data files.
As I'm writing this, I'm not even sure what the official name of the
event I attended today actually was. The phrase "Heroes Happen
Here" was used a lot, as was the term "Launch Event". Well,
whatever you call it, if you're interested in what Microsoft is up
to these days and you're able to find one close to you, do yourself
a favor and check it out.
While Windows Vista Service Pack 1 (SP1) has been available to MSDN
subscribers for a while now, everyone else has been forced to wait to receive
what Microsoft is calling "the benefit of a year's worth of improvements."
Well that wait came to an end today...
While everyone knows that you can manipulate text files and their
contents via an ASP.NET Web page, did you know that you can actually
modify a file's timestamps just as easily? Why would you want to do
that? Read on to find out...
While you can append text to the end of a text file, there's no easy
way to insert, edit, or remove text from a file. To do things like
that, you'll need to read the text from the file, edit it, and then
write it back out.
One of the most common questions I receive about our RSS consuming code
is how to limit the number of items displayed. Luckily, it's relatively
easy to do. Best of all, you can do it without any changes to the code
by simply modifying the style sheet used to transform the RSS
feed's XML to HTML.
Last week we published a tip about using the DefaultButton and
DefaultFocus properties of the HtmlForm object. A reader quickly
informed us that he was having trouble using them on a site which
uses MasterPages. Not to fret... you can still use the properties,
you just need to do things a little bit differently.
ASP.NET 1.x made great strides in simplifying form management and processing, but it did miss a couple points when it came to filling forms out using the keyboard. Fortunately these oversights were quickly noticed by users and Microsoft responded in ASP.NET 2.0 by adding the DefaultButton and DefaultFocus properties to the HtmlForm object.
While ASP.NET server controls make developing Web pages much simpler,
sometimes they don't output their HTML exactly the way you'd like them to.
That's where the Literal Web server control comes in. Unlike most
other controls, it doesn't add anything to the output.
Last week, Microsoft quietly released .NET Framework 2.0 Service Pack 1 and
.NET Framework 3.0 Service Pack 1. If your servers aren't configured to
install updates automatically, now might be a good time to check and
make sure you're up to date.
While the original version accomplished its task using string
functions, this version splits the phrase into an array of words and
then loops through the array capitalizing each word. It just goes
to show that no matter how simple a problem is, there's almost
always more than one solution.
Along with all the other updates in Office 2007, Microsoft has also
changed the file formats. Access now saves its data in .accdb files
instead of the familiar .mdb format. Luckily, with some updated
drivers and a few simple connection string changes, you'll be
connecting to the new files in no time.
It sure took Microsoft long enough to add decent style sheet support
to Visual Studio, but man was it worth the wait. This article
examines the new CSS capabilities available in Visual Studio 2008.
The Best of 2007
As we get ready to welcome 2008, here's a quick list of some of the best content of 2007:
For years I've been telling people that they shouldn't write any VB or VBScript code without first specifying Option Explicit. Well, times change and I no longer use Option Explicit. These days it's Option Strict.
There's no doubt about it, the fact that ASP.NET handles ViewState
for us is a godsend. That being said, this magic that ASP.NET gives
us does come at a cost. That cost is larger web pages... sometimes
surprisingly large.
One of the site's original samples gets a long overdue update.
Along with general code improvements and greatly improved HTML,
you'll also notice that the associated form now stays syncronized
with the calendar.
On Monday, Nov. 19, Microsoft announced that Visual Studio 2008 and
the .NET Framework 3.5 were released to manufacturing. With more
than 250 new features, Visual Studio 2008 includes significant
enhancements in every edition.
Whether you're trying to share settings between your ASP.NET and
classic ASP apps or are simply looking for a way to make your
eventual migration to ASP.NET easier, this piece of code might be
just the ticket.
It recently came to our attention that while most of our ASP.NET
sample code worked fine in the various different versions of the
.NET runtime, a few of the samples weren't overly happy in anything
but an ASP.NET 1.x environment. Since most of you have already
moved to .NET 2.0 or later, it seemed only right that we do the
same. All of our .NET sample code is now running live on version 2.0
of the .NET Framework.
One of our most frequently asked questions comes from our sample
script that lists files and folders on the web server's file system.
The question everyone seems to want answered is how do you write a
version of the script that will traverse sub-folders. It's really
quite simple... take a look at the code and see for yourself.
If you're looking for an ASP.NET version, we've got one of those as well.
It's not quite as
simple as its classic ASP counterpart, but it gets the job done just
as well.
Persisting form values in classic ASP may be a pain, but sometimes
it needs to be done. Luckily for you, this week we've got a sample
that shows you how.
This week we're back with an ASP.NET 2.0 version of
the script we published in answer to the question:
"When I'm sending an HTML
formatted email, is there a way to load my HTML from a file so I
don't have to deal with things like double quotes and vbCrLf
characters?"
One of our visitors recently asked "When I'm sending an HTML
formatted email, is there a way to load my HTML from a file so I
don't have to deal with things like double quotes and vbCrLf
characters?"
If you're anything like me, at times you probably get a little
overwhelmed by the amount of email you need to process. To help you
manage your mail, Microsoft Outlook offers you the ability to flag
messages with different status codes... the most common one being
"Follow up". But why should we have to set this flag ourselves?
This visitor submission displays a calendar in a pop up window so a
user can choose a date. Once that date is picked, the calendar
returns that value to the parent form.
So you're using ASP.NET... no problem. Here's an ASP.NET version
that illustrates how to set timeouts and handle the error that is
thrown when the remote server doesn't respond quickly enough.
This script is a version of our HTTP sample which is designed to
have the request time out in order to illustrate how to handle HTTP
timeout errors. It was written to demonstrate how to use the
WinHttpRequest object's SetTimeout method and handle the error it
throws when a timeout expires.
This sample uses ASP.NET to seach a text file for a user specified
query phrase. It displays the complete file being searched with the
search phrase highlighted and lists the line numbers on which the
search phrase was found at the bottom.
This sample shows you how to search a text file for a phrase.
As currently implemented, it displays the complete file being
searched with the search phrase highlighted and lists the line
numbers on which the search phrase was found at the bottom.