Learn how to import the contents of a text file (.txt) when using MS text or OLE DB Drivers wont do! We will be using the FileSystem and TextStream objects for this lesson!
For the purposes of this article we will be using a text file delimited using the "|" symbol. Here is the contents of the text file we will be using - info.txt.
Category:
In this chapter, we'll be discussing how to get at data from your C# programs using ADO.NET. Over the course of this chapter, we'll be covering the following areas:
Connecting to the database - how to utilize the new SqlConnection and OleDbConnection classes to connect to and disconnect from the database. Connections utilize the same form of connection strings as did OLEDB providers (and therefore ADO), and these are briefly discussed. We then go through a set of best practices for utilizing database connections, and show how to ensure that a connection is closed after use, which is one of the sources of poor application performance.
Executing Commands - ADO.NET has the concept of a command object, which may execute SQL directly, or may issue a stored procedure with return values. The various options on command objects are discussed in depth, with examples to show how commands can be used for each of the options presented by the Sql and OleDB classes.
Stored Procedures - How to call stored procedures using command objects, and how the results of those stored procedures may be integrated back into the data cached on the client.
The ADO.NET object model - this is significantly different from the objects available with ADO, and the DataSet, DataTable, DataRow, and DataColumn classes are all discussed. A DataSet can also include relationships between tables, and also constraints. These issues are also discussed.
Using XML and XML Schemas - ADO.NET is built upon an XML framework, so we'll examine how some of the support for XML has been added to the data classes.
We'll also present a guide to the naming conventions that preside in the world of ADO.NET and explain some of the reasoning behind them. First, though, let's take a brief tour of ADO.NET and see what's on offer
Category:
Many a time, you are confronted with creating a system DSN for use with ASP. If you have an ISP account, this might take time and more than sometimes - money. This article describes how to use File DSNs and save time and money. Also, you can reuse these DSNs and thus, with some modifications, use the same DSN for as many database connections.
Category:
Dropdown lists in HTML are very useful for multiple-option choices, especially within a web form that user needs to fill out.
Producing them dynamically from a database can saves a lot of time and energy.
In this example, we will use ASP 3.0 to generate dynamic dropdown lists from a Microsoft Access database. The database table in question contains fruit and vegetable types.
Category:
There are a great many statistics that you can perform on your data with simple sql. Sum, Average, Max, Min, and Count can be derived nearly as easy as showing the complete detail of your data. The following example utilizes our db (trade date, closing price and daily volume) of EPOS (@PointofSale.com) stock trading performance. Each of the statistics are available in a dropdown menu and the sql that is used on the daily volume is displayed.
Category: