SlideShare a Scribd company logo
Introduction to ASPIntroduction to ASP
(Day 2)(Day 2)
JoniJoni
ATL - Bina NusantaraATL - Bina Nusantara
Agenda
• Database Processing using ADO in ASP
ADO - ActiveX Data Object
• A high-level data access API to access any data
source
• Relational database: Access, MSSQL, Oracle and any
ODBC compliant database
• Non-relational: e.g. Microsoft Index Server, Active
Directory Service
• Dual-interface COM interface
• Can be used in any scripting language (e.g. VBScript
in ASP) and compiled language (e.g. in Delphi).
ADO - ActiveX Data Object
• A high-level data access API to access any data
source
• Relational database: Access, MSSQL, Oracle and any
ODBC compliant database
• Non-relational: e.g. Microsoft Index Server, Active
Directory Service
• Dual-interface COM interface
• Can be used in any scripting language (e.g. VBScript
in ASP) and compiled language (e.g. in Delphi).
A Generic API...
• ADO provides a generic API for data
access. But the underlying data source
may not support some properties /
methods.
• Check the documentation of ADO and
the data provider.
Important ADO Objects
• Connection
• RecordSet
• Command
• How to report error
Making Connection
Dim conn
Dim ConnectionString
ConnectionString = "DSN=Pubs;UID=sa;PWD=pwd;"
Set conn =
Server.CreateObject(“ADODB.Connection”)
conn.Open ConnectionString
‘Now you can use conn to issue SQL command
‘...
conn.Close
Set conn = Nothing
Connection String (ODBC)
"DSN=Pubs;UID=sa;PWD=pwd;”"DSN=Pubs;UID=sa;PWD=pwd;”
“PROVIDER=MSDASQL; DRIVER={Microsoft Access
Driver (*.mdb)};DBQ=C:NWind.mdb; UID=admin;
PWD=;”
“PROVIDER=MSDASQL; DRIVER={Microsoft Access
Driver (*.mdb)};DBQ=C:NWind.mdb; UID=admin;
PWD=;”
“driver={SQL Server};server=srv;
uid=sa;pwd=pwd;database=pubs”
“driver={SQL Server};server=srv;
uid=sa;pwd=pwd;database=pubs”
Using DSN
DSNless, to MS SQL server
DSNless, to Access MDB
DSNless connection
is a bit faster
DSNless connection
is a bit faster
Connection String (OLE DB)
“Provider=Microsoft.Jet.OLEDB.3.51; Data
Source=c:inetpubwwwrootusers.mdb”
“Provider=SQLOLEDB; Data Source=myMachine;
Initial Catalog=pubs; User ID=sa;
Password=pwd”
OLE DB, to MS SQL server
OLE DB, to Access MDB
Direct OLE DB connection is faster than
ODBC connection in both connection
establishment and record retrieval.
Direct OLE DB connection is faster than
ODBC connection in both connection
establishment and record retrieval.
Executing SQL
You’ll need to use ADODB.Command ...
•If your update statement is executed many
times, you should consider using prepared
command for efficiency.
•If you call stored procedure with parameters,
use ADODB.Parameter with ADODB.Command
•If your update statement has BLOB objects, use
Property.AddChunk
You’ll need to use ADODB.Command ...
•If your update statement is executed many
times, you should consider using prepared
command for efficiency.
•If you call stored procedure with parameters,
use ADODB.Parameter with ADODB.Command
•If your update statement has BLOB objects, use
Property.AddChunk
‘assume conn is a live connection
strCommand = “UPDATE, INSERT or DELETE SQL”
conn.Execute strCommand, nRecordsAffected
Retrieving Data using RecordSet
‘assume conn is a live connection
strQuery = “select * from Employee”
Set rs =
Server.CreateObject(“ADODB.RecordSet”)
rs.Open strQuery, conn, cursorType, lockType
Do While Not rs.EOF
‘access the current record by
rs(“fieldname”)
‘or rs(fieldnum)
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cursorType and lockType
are optional. The default
values are
adOpenForwardOnly and
adLockReadOnly
cursorType and lockType
are optional. The default
values are
adOpenForwardOnly and
adLockReadOnly
Retrieving Data using RecordSet
‘assume conn is a live connection
conn.BeginTrans
conn.Execute strCommand1
conn.Execute strCommand2
‘...
conn.CommitTrans
‘or conn.RollbackTrans
Demo

More Related Content

What's hot

Javascript on Server-Side
Javascript on Server-SideJavascript on Server-Side
Javascript on Server-Side
ASIMYILDIZ
 
RavenDB Presentation
RavenDB PresentationRavenDB Presentation
RavenDB PresentationMark Rodseth
 
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Restlet
 
Lokijs
LokijsLokijs
Microservice-based software architecture
Microservice-based software architectureMicroservice-based software architecture
Microservice-based software architecture
ArangoDB Database
 
Understanding LINQ in C#
Understanding LINQ in C# Understanding LINQ in C#
Understanding LINQ in C#
MD. Shohag Mia
 
RavenDB - Indexes Deep Dive
RavenDB - Indexes Deep DiveRavenDB - Indexes Deep Dive
RavenDB - Indexes Deep DiveAlonso Robles
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
Brian Ritchie
 
Azure DocumentDB 101
Azure DocumentDB 101Azure DocumentDB 101
Azure DocumentDB 101
Ike Ellis
 
Arango DB
Arango DBArango DB
ArangoDB
ArangoDBArangoDB
Extensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software ArchitectureExtensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software Architecture
Max Neunhöffer
 
RavenDB Overview
RavenDB OverviewRavenDB Overview
RavenDB Overview
Julie Lerman
 
Presentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membasePresentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membase
Ardak Shalkarbayuli
 
NoSQL Database in .NET Apps
NoSQL Database in .NET AppsNoSQL Database in .NET Apps
NoSQL Database in .NET AppsShiju Varghese
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL Database
Andreas Jung
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
Introduction to RavenDB
Introduction to RavenDBIntroduction to RavenDB
Introduction to RavenDB
Sasha Goldshtein
 
D2RQ
D2RQD2RQ

What's hot (20)

Javascript on Server-Side
Javascript on Server-SideJavascript on Server-Side
Javascript on Server-Side
 
RavenDB Presentation
RavenDB PresentationRavenDB Presentation
RavenDB Presentation
 
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
 
Lokijs
LokijsLokijs
Lokijs
 
Microservice-based software architecture
Microservice-based software architectureMicroservice-based software architecture
Microservice-based software architecture
 
Understanding LINQ in C#
Understanding LINQ in C# Understanding LINQ in C#
Understanding LINQ in C#
 
RavenDB - Indexes Deep Dive
RavenDB - Indexes Deep DiveRavenDB - Indexes Deep Dive
RavenDB - Indexes Deep Dive
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
 
Azure DocumentDB 101
Azure DocumentDB 101Azure DocumentDB 101
Azure DocumentDB 101
 
Arango DB
Arango DBArango DB
Arango DB
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 
Extensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software ArchitectureExtensible Database APIs and their role in Software Architecture
Extensible Database APIs and their role in Software Architecture
 
RavenDB Overview
RavenDB OverviewRavenDB Overview
RavenDB Overview
 
Presentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membasePresentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membase
 
NoSQL Database in .NET Apps
NoSQL Database in .NET AppsNoSQL Database in .NET Apps
NoSQL Database in .NET Apps
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL Database
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to rails
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
 
Introduction to RavenDB
Introduction to RavenDBIntroduction to RavenDB
Introduction to RavenDB
 
D2RQ
D2RQD2RQ
D2RQ
 

Similar to Asp #2

PI-RDBMS.ppt
PI-RDBMS.pptPI-RDBMS.ppt
PI-RDBMS.ppt
Ajay Gangakhedkar
 
Database and database Application interface
Database and database Application interfaceDatabase and database Application interface
Database and database Application interface
Mozamel Jawad
 
Dbms & prog lang
Dbms & prog langDbms & prog lang
Dbms & prog langTech_MX
 
JDBC java for learning java for learn.ppt
JDBC java for learning java for learn.pptJDBC java for learning java for learn.ppt
JDBC java for learning java for learn.ppt
kingkolju
 
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBCBI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
Simba Technologies
 
Ado.net
Ado.netAdo.net
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
S.Shayan Daneshvar
 
Jdbc
JdbcJdbc
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
Hemo Chella
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
1. java database connectivity (jdbc)
1. java database connectivity (jdbc)1. java database connectivity (jdbc)
1. java database connectivity (jdbc)
Fad Zulkifli
 
Serverless Data Platform
Serverless Data PlatformServerless Data Platform
Serverless Data Platform
Shu-Jeng Hsieh
 
Adodb Pdo Presentation
Adodb Pdo PresentationAdodb Pdo Presentation
Adodb Pdo Presentation
Tom Rogers
 
Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Mubarak Hussain
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt
NaveenKumar648465
 

Similar to Asp #2 (20)

PI-RDBMS.ppt
PI-RDBMS.pptPI-RDBMS.ppt
PI-RDBMS.ppt
 
Database and database Application interface
Database and database Application interfaceDatabase and database Application interface
Database and database Application interface
 
Dbms & prog lang
Dbms & prog langDbms & prog lang
Dbms & prog lang
 
JDBC java for learning java for learn.ppt
JDBC java for learning java for learn.pptJDBC java for learning java for learn.ppt
JDBC java for learning java for learn.ppt
 
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBCBI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
 
Ado.net
Ado.netAdo.net
Ado.net
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
Microsoft data access components
Microsoft data access componentsMicrosoft data access components
Microsoft data access components
 
Jdbc
JdbcJdbc
Jdbc
 
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
1. java database connectivity (jdbc)
1. java database connectivity (jdbc)1. java database connectivity (jdbc)
1. java database connectivity (jdbc)
 
Serverless Data Platform
Serverless Data PlatformServerless Data Platform
Serverless Data Platform
 
Adodb Pdo Presentation
Adodb Pdo PresentationAdodb Pdo Presentation
Adodb Pdo Presentation
 
Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt
 
jdbc
jdbcjdbc
jdbc
 

More from Joni

ASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と Channel
ASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と ChannelASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と Channel
ASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と Channel
Joni
 
.NET Framework で ​C# 8って使える? ​YESとNO!
.NET Framework で ​C# 8って使える? ​YESとNO!.NET Framework で ​C# 8って使える? ​YESとNO!
.NET Framework で ​C# 8って使える? ​YESとNO!
Joni
 
.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築
.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築
.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築
Joni
 
Fiddler 使ってますか?
Fiddler 使ってますか?Fiddler 使ってますか?
Fiddler 使ってますか?
Joni
 
Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例
Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例
Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例
Joni
 
ASP.NET パフォーマンス改善
ASP.NET パフォーマンス改善ASP.NET パフォーマンス改善
ASP.NET パフォーマンス改善
Joni
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NET
Joni
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET Application
Joni
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
Joni
 
C#
C#C#
C#
Joni
 
Asp #1
Asp #1Asp #1
Asp #1
Joni
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Joni
 
ASP.NET MVCはNullReferenceExceptionを潰している件
ASP.NET MVCはNullReferenceExceptionを潰している件ASP.NET MVCはNullReferenceExceptionを潰している件
ASP.NET MVCはNullReferenceExceptionを潰している件
Joni
 

More from Joni (13)

ASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と Channel
ASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と ChannelASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と Channel
ASP.NET Core の ​ パフォーマンスを支える ​ I/O Pipeline と Channel
 
.NET Framework で ​C# 8って使える? ​YESとNO!
.NET Framework で ​C# 8って使える? ​YESとNO!.NET Framework で ​C# 8って使える? ​YESとNO!
.NET Framework で ​C# 8って使える? ​YESとNO!
 
.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築
.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築
.NET Core 3.0 で Blazor を使用した​フルスタック C# Web アプリ​の構築
 
Fiddler 使ってますか?
Fiddler 使ってますか?Fiddler 使ってますか?
Fiddler 使ってますか?
 
Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例
Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例
Fukuoka.NET Conf 2018: 挑み続ける!Dockerコンテナによる ASP.NET Core アプリケーション開発事例
 
ASP.NET パフォーマンス改善
ASP.NET パフォーマンス改善ASP.NET パフォーマンス改善
ASP.NET パフォーマンス改善
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NET
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET Application
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
 
C#
C#C#
C#
 
Asp #1
Asp #1Asp #1
Asp #1
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
ASP.NET MVCはNullReferenceExceptionを潰している件
ASP.NET MVCはNullReferenceExceptionを潰している件ASP.NET MVCはNullReferenceExceptionを潰している件
ASP.NET MVCはNullReferenceExceptionを潰している件
 

Recently uploaded

How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 

Recently uploaded (20)

How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 

Asp #2

  • 1. Introduction to ASPIntroduction to ASP (Day 2)(Day 2) JoniJoni ATL - Bina NusantaraATL - Bina Nusantara
  • 3. ADO - ActiveX Data Object • A high-level data access API to access any data source • Relational database: Access, MSSQL, Oracle and any ODBC compliant database • Non-relational: e.g. Microsoft Index Server, Active Directory Service • Dual-interface COM interface • Can be used in any scripting language (e.g. VBScript in ASP) and compiled language (e.g. in Delphi).
  • 4. ADO - ActiveX Data Object • A high-level data access API to access any data source • Relational database: Access, MSSQL, Oracle and any ODBC compliant database • Non-relational: e.g. Microsoft Index Server, Active Directory Service • Dual-interface COM interface • Can be used in any scripting language (e.g. VBScript in ASP) and compiled language (e.g. in Delphi).
  • 5. A Generic API... • ADO provides a generic API for data access. But the underlying data source may not support some properties / methods. • Check the documentation of ADO and the data provider.
  • 6. Important ADO Objects • Connection • RecordSet • Command • How to report error
  • 7. Making Connection Dim conn Dim ConnectionString ConnectionString = "DSN=Pubs;UID=sa;PWD=pwd;" Set conn = Server.CreateObject(“ADODB.Connection”) conn.Open ConnectionString ‘Now you can use conn to issue SQL command ‘... conn.Close Set conn = Nothing
  • 8. Connection String (ODBC) "DSN=Pubs;UID=sa;PWD=pwd;”"DSN=Pubs;UID=sa;PWD=pwd;” “PROVIDER=MSDASQL; DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:NWind.mdb; UID=admin; PWD=;” “PROVIDER=MSDASQL; DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:NWind.mdb; UID=admin; PWD=;” “driver={SQL Server};server=srv; uid=sa;pwd=pwd;database=pubs” “driver={SQL Server};server=srv; uid=sa;pwd=pwd;database=pubs” Using DSN DSNless, to MS SQL server DSNless, to Access MDB DSNless connection is a bit faster DSNless connection is a bit faster
  • 9. Connection String (OLE DB) “Provider=Microsoft.Jet.OLEDB.3.51; Data Source=c:inetpubwwwrootusers.mdb” “Provider=SQLOLEDB; Data Source=myMachine; Initial Catalog=pubs; User ID=sa; Password=pwd” OLE DB, to MS SQL server OLE DB, to Access MDB Direct OLE DB connection is faster than ODBC connection in both connection establishment and record retrieval. Direct OLE DB connection is faster than ODBC connection in both connection establishment and record retrieval.
  • 10. Executing SQL You’ll need to use ADODB.Command ... •If your update statement is executed many times, you should consider using prepared command for efficiency. •If you call stored procedure with parameters, use ADODB.Parameter with ADODB.Command •If your update statement has BLOB objects, use Property.AddChunk You’ll need to use ADODB.Command ... •If your update statement is executed many times, you should consider using prepared command for efficiency. •If you call stored procedure with parameters, use ADODB.Parameter with ADODB.Command •If your update statement has BLOB objects, use Property.AddChunk ‘assume conn is a live connection strCommand = “UPDATE, INSERT or DELETE SQL” conn.Execute strCommand, nRecordsAffected
  • 11. Retrieving Data using RecordSet ‘assume conn is a live connection strQuery = “select * from Employee” Set rs = Server.CreateObject(“ADODB.RecordSet”) rs.Open strQuery, conn, cursorType, lockType Do While Not rs.EOF ‘access the current record by rs(“fieldname”) ‘or rs(fieldnum) rs.MoveNext Loop rs.Close Set rs = Nothing cursorType and lockType are optional. The default values are adOpenForwardOnly and adLockReadOnly cursorType and lockType are optional. The default values are adOpenForwardOnly and adLockReadOnly
  • 12. Retrieving Data using RecordSet ‘assume conn is a live connection conn.BeginTrans conn.Execute strCommand1 conn.Execute strCommand2 ‘... conn.CommitTrans ‘or conn.RollbackTrans
  • 13. Demo