ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
ASP Dot Net Tutorial - Index
ASP Dot Net Tutorial - Microsofts ASP.NET
ASP Dot Net Tutorial - Begining Web Forms
ASP Dot Net Tutorial - User Controls
ASP Dot Net Tutorial - ADO .NET
ASP Dot Net Tutorial - DataBinding to WebControls
ASP Dot Net Tutorial - DataList Controls
ASP Dot Net Tutorial - DataGrid Control
ASP Dot Net Tutorial - Advance Practical Examples on DataGrid
ASP Dot Net Tutorial - Working with DataSets
ASP Dot Net Tutorial - Working with XML
ASP Dot Net Tutorial - Forms Based Authentication
ASP Dot Net Tutorial - Windows Based Authentication
     

 
Online Personal Trainer Certification
Test Search by Job Title
Find a Personal Trainer
Job Resources
Free Self Tests and Quizzes
Find a Lawyer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Six Sigma Green Belt Certification
Lean Management Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
SEO Certification
Online Photography Course & Certification
Online Business Writing Course & Certification
Baby Sitting Course & Certification
Time Manangement Certification
Health Club Management Certification
Selling Skills Certification
Business Analysis Course
Green Living Course  free!
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > ASP.NET Tutorial > ADO.NET
 

ASP.NET Tutorial - ADO.NET

                                                                                                             Page 11 of 14
 

 

Example 32 OledbParameterUpdate.asp

<%@ Import Namespace="System.Data.Oledb" %>

<Script Runat="Server">

Sub Button_Click (s As Object, e As EventArgs)

Dim conNorthwind As OledbConnection

Dim strUpdate As String

Dim cmdUpdate As OledbCommand

Dim intRecordCount As Integer

conNorthwind=NewOledbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;

DATA Source =c:\Books.mdb")

strUpdate = "Update Books Set Author=@author_name Where bookName=@book_name"

cmdUpdate = New OledbCommand( strUpdate, conNorthwind )

cmdUpdate.Parameters.Add( "@book_name", txtBookName.Text )

cmdUpdate.Parameters.Add( "@author_name", txtAuthorName.Text )

conNorthwind. Open ()

intRecordCount = cmdUpdate.ExecuteNonQuery()

conNorthwind. Close ()

lblAuthor. Text = intRecordCount & " records updated!"

End Sub

</Script>

<html>

<body>

<form Runat="Server">

<h3>Update Book's Name</h3>

<b>Book Name</b>

<br>

<asp:TextBox

ID="txtBookName"

Runat="Server" />

<p>

<br>

<b>Author's Name</b>

<br>

<asp:TextBox

ID="txtAuthorName"

Runat="Server" />

<p>

<asp:Button

Text="Update Author"

OnClick="Button_Click"

Runat="Server" />

<p>

<asp:Label

ID="lblAuthor"

Runat="Server" />

</form>

</body>

</html>

 

 

The output of this example is as shown below:-

The above example has two TextBox controls: one for a Book’s name and other in Author’s Name. When you click the Update Author! Button, the Button Click subroutine is executed, and the phone number for the proper author is updated.

Finally, the number of records updated is retrieved from the ExecuteNonQuery () method of the OleDbCommand class. This result is assigned to a Label control lblAuthor.

 

       

.

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2006. All Rights Reserved.