Using ADO Programmatically The Connection Object and the Command Object.

Slides:



Advertisements
Similar presentations
1 Interface IDbConnection ConnectionString defines data base connection Open and close connection Properties of connection object Creates Command-Object.
Advertisements

Different type of input Use of Basic language with Excel Silvia Patacchini.
Internal connection and introduction to shape language Please use speaker notes for additional information.
VBA Modules, Functions, Variables, and Constants
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
ActiveX Data Object ISYS 562. ADO An ActiveX control ActiveX is build upon COM, a contract that defines a standard interface by which objects communicate.
Using ADO Programmatically The Connection Object, Command Object, and Recordset Object.
Using Visual Basic 6.0 to Create Web-Based Database Applications
ActiveX Data Control BICS 546. Intrinsic and ActiveX Controls VB supports two types of controls: –Intrinsic controls (command button, listbox, etc): When.
Programming the RecordSet Object
Database Connectivity Session 2. Topics Covered ADO Object Model Database Connection Retrieving Records Creating HTML Documents on-the-fly.
Dynamic Web Sites DECO 3001 Tutorial 6 – Form Presented by Ji Soo Yoon 30 April 2004 Slides adopted from
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
ASP & ADO. Connection Object An implicit connection is created when we open a recordset without a connection object. –rs.open “Customer”, "DSN = Sales”
FTP File Transfer Protocol. Introduction transfer file to/from remote host client/server model  client: side that initiates transfer (either to/from.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Private Sub Close_Click() On Error GoTo Err_Close_Click DoCmd.Close Exit_Close_Click: Exit Sub Err_Close_Click: MsgBox Err.Description Resume Exit_Close_Click.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
ActiveX Data Object (ADO) in JavaScript J.L.Wang, Yen-Cheng Chen Dept. of Infomation Management Ming-Chuan University Jan
Introduction to ADO By David R. Stevenson Consulting Software Engineer ABB Automation.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Using Visual Basic 6.0 to Create Web-Based Database Applications
Database actions In this presentation… –database actions –database connections –recordsets.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
Microsoft Access Using Visual Basic Routines. Visual Basic Datatypes Boolean Byte Currency Date Double Integer Long Object Single String Variant Hyperlink.
A few slides on MS Access Record Locking and Transactions.
ADO 2.5 Kamaljit Bath, Program Manager Data Access Group.
Faculty of Electronic Engineering 1 Database Access API’s Aleksandar Stanimirović Leonid Stoimenov Aleksandar Milosavljević.
EM412 Using Adaptive Server Anywhere with Visual Basic Ali Chalhoub Technical Support Consultant iAnywhere Solutions
Lecture Note 10: Simple Database Techniques. Introduction –Database System –Access, SQL Server and others. –Microsoft Access - Interacting with this databases.
Visual Basic ADO Programming 56:150 Information System Design.
Effective Security in ASP.Net Applications Jatin Sharma: Summer 2005.
Remote programs and commands In this presentation… –rpc concepts –rpc connections –rpc actions.
What is database?  Any Method for access info into Application from DataBase?  ODBC is standard for Accessing Data.  Problem with ODBC:  Information.
ADO.NET Data Access. Page  2 SQL  When we interact with the datasource through ADO.NET we use the SQL language to retrieve,modify,update information.
ActiveX Data Objects (ADO) is Microsoft’s latest database object model. The goal of ADO is to allow VB developers to use a standard set of objects to refer.
24/01/2011 harshana-fernando.blogspot.com 1 Introduction to Procedures Modules A module is a file that holds code or pieces of code in a Visual Basic application.
Notes on ADO from other projects Please use speaker notes for additional information!
Chapter 21: Working with Large Data Re-Visited Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
ASP-12-1 Data Store Access Colorado Technical University IT420 Tim Peterson.
Lab 8 Data Access Using Microsoft ActiveX Data Object (ADO)
HNDIT Rapid Application Development
ADO ActiveX Data Object. ActiveX Data Objects (ADO) is Microsoft’s latest database object model. The goal of ADO is to allow VB developers to use a standard.
What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group
Understanding Visual Basic Fundamentals CHAPTER 13 Understanding Visual Basic Fundamentals.
Source = Table rsObject.Open tablename, Connection Object, CursorType, LockType, adCmdTable Source = Stored Procedure rsObject.Open stored procedure name,
ASP-14-1 Advanced ASP Techniques Colorado Technical University IT420 Tim Peterson.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 6: Accessing a database with PHP Rob Gleasure robgleasure.com.
ASP-13-1 Recordsets Colorado Technical University IT420 Tim Peterson.
1 ADO Activex Data Objects. 2 ADO ADO allows users to access data easily from many existing databases (such as Access or Paradox) From ODBC compliant.
DATABASE SYSTEM VB LINK TO MS-SQL. 2 Visual ProgrammingChapter 6 Select Project -> Component.
ADO and DataList, DataCombo and DataGrid Controls Please use speaker notes for additional information!
Using databases ActiveX Data Objects (ADO) Connecting to a database Reading data from a database Inserting, updating and deleting records Using databases.
Data Control In this presentation… –databases supported –inserting a data control –data control properties –using the data control.
 2 Data Object Library approaches ◦ DAO (Data Access Objects)  Original access strategy (up to VB6)  Closely linked to MS Access ◦ ADO (ActiveX Data.
ASP.NET Programming with C# and SQL Server First Edition
ADO VBA Programming in Access
Find, filter etc with connection to Access code internally
ActiveX Data Objects (ADO)
Programming the Web Using ASP.Net
How to Create Login Form using vb.net and SqlServer Database
5. Using databases in VB.
Using local variable without initialization is an error.
VB.NET Using Database.
ربط الفيجوال بيسك VB مع قواعد البيانات
Please use speaker notes for additional information!
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Database Objects 1/12/2019 See scm-intranet.
Excel Import data from Access to Excel (ADO) using VBA
Source: Link Posted By: HeelpBook Permalink: Link
Presentation transcript:

Using ADO Programmatically The Connection Object and the Command Object

Using ADO Programmatically To perform ADO operations without the aid of the ADO Data control: –Establish a connection to a data source –Define a command –Execute the command –Commands may or may not return records. If they do, create a recordset. –Manipulate the records in the recordset as desired.

ADO Object Hierarchy A Connection object represents an open connection to a data source. Connection Command Recordset Errors

Connection Object Properties ConnectionString ConnectionTimeout CommandTimeout Mode Provider

Connection Object Methods Open Close BeginTrans CommitTrans RollbackTrans

Building the Connection Object Programmatically Create an instance of an ADO Connection object Set the necessary arguments for the ConnectionString property of the Connection object. Call the Open method of the Connection object.

ConnectionString Property The ConnectionString property is a string with which you specify a data source. It defines connection information in the form of argument = value pairs separated by semicolons (;). ADO supports the following arguments: –Provider –Data Source –User ID and Password –File Name –Remote Provider and Remote Server

Creating an Instance of the ADO Object You must create an instance of a particular ADO object before you can use it. Example: Dim conMagnet As New ADODB.Connection

Private Sub Form_Load() ' Declare the Connection object. Dim conMagnet As New ADODB.Connection ' Define the properties for the Connection object ' then open the connection. conMagnet.Mode = adModeShareDenyNone conMagnet.CursorLocation = adUseClient conMagnet.Provider = "Microsoft.Jet.OLEDB.4.0" conMagnet.ConnectionString = "Data Source=A:\Magnet.mdb” conMagnet.Open End Sub

The Command Object Properties –ActiveConnection –CommandType adCmdText, adCmdTable, adCmdStoredProcedure –CommandText –CommandTimeout Methods –Execute –Cancel

Private Sub Form_Load() ' Declare the Connection and Command objects. Dim conMagnet As New ADODB.Connection Dim cmdMagnet As New ADODB.Command ' Define the properties for the Connection object ' then open the connection. conMagnet.Mode = adModeShareDenyNone conMagnet.CursorLocation = adUseClient conMagnet.Provider = "Microsoft.Jet.OLEDB.4.0" conMagnet.ConnectionString = "Data Source=A:\Magnet.mdb" conMagnet.Open ' Define the propeties for the Command object. Set cmdMagnet.ActiveConnection = conMagnet cmdMagnet.CommandType = adCmdTable cmdMagnet.CommandText = "tblOrderMaster“ End Sub

' Module level variable to store a reference to the form's recordset. Private rstCurrent As New ADODB.Recordset Private Sub Form_Load() Dim conMagnet As New ADODB.Connection Dim cmdMagnet As New ADODB.Command conMagnet.Mode = adModeShareDenyNone conMagnet.CursorLocation = adUseClient conMagnet.Provider = "Microsoft.Jet.OLEDB.4.0" conMagnet.ConnectionString = "Data Source=A:\Magnet.mdb" conMagnet.Open Set cmdMagnet.ActiveConnection = conMagnet cmdMagnet.CommandType = adCmdTable cmdMagnet.CommandText = "tblOrderMaster“ rstCurrent.Open cmdMagnet End Sub