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
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

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

ASP.NET Tutorial - ADO.NET

                                                                                                               Page 6 of 14
 

The output of this example is as shown below:

The example above contains two TextBox controls named tbFirstname and tbLastname. When the values are entered into the two Textbox controls and Submit clicked, the Button Click subroutine is executed.

The Button Click subroutine creates an instance of the SqlCommand class with a parame­tric Select statement. Two instances of the SqlParameter class are created and added to the Parameters collection of the SqlCommand class. For example, the @firstname para­meter is created and added with the following statement:

This statement creates a new SqlParameter named @firstname and further adds to the Parameters collection of the SqlCommand class. Passing its name and value creates the parameter. In this case, the value of the parameter is the value of the tbFirstname TextBox control.

Using Parameters with MS Access

 When using the classes from the System.Data.OleDb namespace, you need to create the parameters for MS Access. For example, to retrieve a phone number for an employee from the Employees table of Northwind database, you have to write the SQL statement like: -

What is Character?

This represents the parameter instead of using a named parameter like @firstname or @lastname.

Important Note: - (i) Use @ character for SQL SERVER

(ii) Use? Or @ character with MS Access.

But is? Recommended with MS ACCESS

Example 24 illustrates how you can use parametric queries with a Microsoft Access database.

The output of above example is shown below:

       

 

.

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