21 items found in the ADO.NET Category
Mikesdotnetting - Sunday, February 21, 2010 8:21 AM
Pretty much every sample application that illustrates ASP.NET MVC uses Linq To SQL or the Entity Framework as the data access method. I've seen a number of questions posted to the forums at www.asp.net asking if there are any alternatives, and indeed there are. This article will look at using plain ADO.NET within a data access layer to provide dynamic content to a typical small CRUD application.
Mikesdotnetting - Monday, September 28, 2009 9:53 PM
Since my article on using parameters for Preventing SQL Injection In ASP.NET, I have had a few emails asking how to do the same with an IN clause expression. In this entry, I explore a couple of ways to do this.
Mikesdotnetting - Wednesday, August 19, 2009 7:28 AM
I, and many other contributors to the forums at www.asp.net find examples of code posted on a daily basis that are vulnerable to SQL Injection attacks. We continue to exhort beginners (and some more experienced programmers) to code against them. This article examines just how serious a flaw vulnerable coding can be, and what you should do about it.
Mikesdotnetting - Wednesday, July 9, 2008 9:19 AM
Building on my previous article on importing text files of various formats to an Access database, here's how to do the same thing simply and efficiently with Excel files.
Mikesdotnetting - Saturday, May 17, 2008 9:48 AM
There are a variety of options for connecting to Access databases within ASP.NET pages. This article attempts to cover the choices and offer recommendations for getting the best out of Access.
Mikesdotnetting - Thursday, May 1, 2008 11:06 AM
This short article deals with the following common MS Access-related error messages:
Mikesdotnetting - Thursday, May 1, 2008 10:02 AM
Quite often, I see questions asked about creating a simple login page for use with Access from people who don't want to take advantage of the built-in Forms Authentication framework within ASP.NET. The following samples show how relatively easy this is to accomplish.
Mikesdotnetting - Wednesday, April 30, 2008 10:48 PM
The unbelievably cryptic Operation Must Use An Updateable Query error is the bane of developers who are just starting out with Access and ASP.NET. You've done your code, plopped your database file in the App_Data folder (or at least, you should have done), and try to run a page that INSERTs or UPDATEs records, and it all stops dead. This brief article explains the cause of the error, and the steps required to stop it recurring.
Mikesdotnetting - Wednesday, November 28, 2007 1:19 PM
There are a whole bunch of articles, blog entries and tutorials that seek to explain how SQL JOINS work. Some of them are excellent, and others are just confusing. The reason I am adding my go at trying to clarify JOINS to the mix is to highlight how proper use of the tools available to you can seriously reduce the chances of getting the JOIN syntax or type wrong. Since JOINS are all about how to relate data from one table to another, I thought it appropriate to illustrate the subject using Parents and Children (who may, or may not be related to eachother). So let's meet the families.
Mikesdotnetting - Friday, November 16, 2007 10:45 AM
Yes, you did read that correctly. Here's the situation: you know that Sql Server is by far the superior database system (if indeed MS Access can be called a database system). You also know that MS Access databases are not recommended as a data store for web applications. You are comfortable with Sql Server, and haven't really looked at Access for years - if at all. But now, your boss or your client wants you to use it in the next project.
Mikesdotnetting - Monday, November 12, 2007 3:15 PM
Creating a search interface for one user-supplied value is pretty straightforward: a TextBox for input, a Button and some SQL that searches one or more fields where the values are LIKE '%' + @searchterm + '%' is all that is needed. While it works, this approach is not very flexible. For example, what if you wanted to search for an Employee whose last name contains "a", and don't want those where the first name or city contains "a"? The traditional solution to this is to dynamically construct the SQL statement based on what values were passed by the user. However, building the SQL string can get repetitive, boring and messy. Here is a cleaner way to allow the user to narrow down searches across multiple criteria with the use of optional parameters, and just 3 lines of programming code.
Mikesdotnetting - Sunday, September 9, 2007 9:20 PM
The Jet 4.0 OLEDB driver is a remarkable beast. Not only will it allow connections to MS Access .mdb files and MS Excel spreadhseets, but it will also allow you to connect to and query a variety of text file formats. Here are some examples that illustrate this capability when applied to importing text based data into Access.
Mikesdotnetting - Saturday, August 25, 2007 10:32 AM
Label controls in ASP.NET don't have a smart tag that allows you to select a data source, so at first glance, it is not easy to see how to bind a value returned from a SqlDataSource or AccessDataSource control to the label. Here's how to programmatically access the data returned by such a DataSource and apply it to a non-databound control.
Mikesdotnetting - Thursday, August 2, 2007 11:41 PM
A question that often comes up in forums is how to export data to a CSV file, or other text format. Here's a method that takes data from a DataReader and writes it to a file.
Mikesdotnetting - Friday, July 27, 2007 2:24 PM
This item could also have been entitled "Displaying Master-Detail Data" or "Displaying Categorised Data", but the principal is the same: you have what are essentially headings or categories, and a group of entries that belong to each heading that you want to display. Typical examples would include the Models of cars by Manufacturer, or Employees by Department. Here's how to do it quite simply using nested Repeaters.