Updating sql database in vb net dating programme paddy mcguinness
NET 2.0 introduced a number of new Web controls designed for accessing and modifying data. In short, with the Data Source controls you can work with data without having to write a lick of data access code. NET 1.x, which required oft-repeated code to access data.
These controls allow page developers to declaratively access and modify data without writing any code to perform the data access. For example, to display the contents of a database table in a web page with ASP. NET 2.0, data can be accessed entirely from declarative markup.
With the declarative, "code free" Data Source controls you can create a page that displays database data in under 15 seconds and without having to write a line of code. Both controls have virtually the same featureset, the only difference being how you specify the connection information.
In fact, the Access Data Source control is really superfluous since Microsoft Access databases can be accessed through the Sql Data Source control just as easily.
(True, you have to provide a connection string rather than simply the path to the file, but Visual Studio 2005 can automatically create appropriate connection strings for those databases residing in your folder.) In this article we'll examine the Sql Data Source in detail, just touching upon the one difference in the Access Data Source.
The code to connect to the database, issue the command, and retrieve the results is handled internally by the Data Source control.
For this article I'm going to demonstrate connecting to, retrieving, and displaying data from the Microsoft Access Northwind database, which is included in the download.
While you can set all of these properties by hand in the Source view, the Design view offers a time-saving wizard for quickly specifying which database to connect to and what query to issue.
To get started, fire up Visual Studio 2005 and create a new website or, alternatively, download the code example at the end of this article.
We'll see how to use these Data Source controls to modify database data in a future installment.
Also, we'll focus on working with these Data Source controls in Visual Studio 2005 through the Design view.