NEW LISTINGS  HOT LISTINGS  TOP RATED  EDITOR PICK  ADD A LISTING  UPDATE A LISTING  GET RATED  UPGRADE A LISTING
  HOME     MY ACCOUNT     POWER SEARCH     REGISTER     MEMBER LIST     SUGGEST CATEGORY  

Average Visitor Rating: 0.00 (out of 5)
Number of ratings: 0 Votes

Visitor Rating

Updating records in the database with ASP
2629 Updating records in the database with ASP http://www.stardeveloper.com/asp_updaterec_1.asp We have already discussed how to create DSN and show database contents in the ASP page in our tutorial Accessing Database from ASP. Then we moved on to learn how to add records to the database in the tutorial Adding Records to the Database. We will now see how to update the records in the database ASP > Tips and Tutorials > Database-related Oct 10, 2006

Write a Review   Add to My Favorite   Refer it to Friend   Report Broken Link  

Bookmark Updating records in the database with ASP:


Other links at ASP > Tips and Tutorials > Database-related
Collecting visitor information is a useful tool for any webmaster. Whether it's collecting suggestions to improve your site, or contact information for sales leads, visitor information is a valuable resource. The following download will allow your visitors to submit their name, email, and any comments.

It is written with a minimalist implementation and lots of comments to make it easier for you to customize to your site's needs. The code is good "out of the box", just unzip the files and put them on your webserver and you're all set (though you will want to add your own site's design around the code). If you wish to have the database file in another folder, make sure you update the strDatabasePath variable in BasicForm.asp
Category:

This one's like a double whammie! Welcome to the world of hard core SQL Server stored procedures and to the NextRecordset method of ADO's recordset object... Before we go on, this requires SQL Server. WON'T WORK WITH ACCESS.

That said, the goal for this example was easy... Get a list of all current tables in the database created by your's truly, get a list of dependent stored procedures for each table and do it all in a stored procedure! Easy...

There are basically 2 parts to this example. The calling application (a VBScript class called SQLServerTools) and the SQL Server stored procedure: sp_Admin_ExampleTablesDependencies (included with the class). The VBScript class is easy and contains only 1 method. That method is a great example of how to use the NextRecordset method of ADO to capture a second (or 50th) recordset returned by a procedure. For example, did you know this was valid SQL:

"SELECT * FROM table1;SELECT * FROM table2;"

Well it is, SQL Server knows that this statement should produce two separate and distinct recordsets however if you execute that and don't use NextRecordset, you will only get that first RS back. The stored procedure I wrote to do all the work is the second part of the example. That procedure returns (2 * num of tables) recordsets which is variable and based on the number of tables found in sysobjects for your particular db. Bottom line, that procedure always returns more than 1 recordset.

Right now, as you read this, I estimate that the procedure returned as many as 30 recordsets that were looped through with NextRecordset... But that's not the real magic. The class only exists to call the procedure and work with it's results. The stored procedure itself does all the work.

I've commented both the app and the stored procedure to the max but I'll give you an overview of the stored procedure... The stored procedure uses a cursor to loop through the records of a recordset returned by the system table: sysobjects. The process used is almost the same as using ADO to manipulate a recordset but right in the db itself... this means huge speed bonus and, by writing a stored procedure, all that logic is forever contained within and isn't spilled out into the class where it doesn't belong.

So anyways, while the procedure is looping through each table returned by sysobjects, it's simultaneously calling the system stored procedure: sp_depends. sp_depends is a handy function that returns a recordset of names representing every stored procedure that references the entered table! sp_depends can be used on any object, not just tables, but that is another discussion for another day...
Category:

Selecting, deleting and inserting database records is part and parcel of dynamic web development...be it ASP, PHP, Python, whatever.....and of course, add to that list updating records.....But how to do it in Classic ASP?....well, I'm about to show you in 3 simple steps, so grab a can of Dr Pepper and pay attention, because you're about to get schooled....:)
Category:

Displaying specific subsets of data from a database is easy to accomplish in .asp. The following example utilizes our Access database of Mark "The Bird" Fidrych and displays all of his season statistics for 1976 contained in the database rather than displaying the entire db.
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:




Main Category
194
2041
824
286
175
1802
1238
913
1163
7489
70
909
59
2222
174

Join Mailing List
Joining mailing list will entitle you to receive occasional emails informing you of news and updates to the site and any special offers that may be of interest to you.



Top 10
Directory Statistics

Links: 19539
Categories: 1275
Registered Users: 750
Mailing List Subscribers: 2046
Unique Outgoing Hits: 228054

Pagerank Statistics
PR 10
1 site(s)
PR 9
13 site(s)
PR 8
30 site(s)
PR 7
258 site(s)
PR 6
766 site(s)
PR 5
1888 site(s)

PHP News