web 2.0

ADO Command Object

ADO Command Object This the tutorial/example  learn ADO command object.

ShotDev Focus:
- ASP & ADO Command Object

CommandText - Method for create command.


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
Set Comm = Server.CreateObject("ADODB.Command")
Set Comm.CommandText = "SELECT * FROM customer "
Set objRec = Comm.Execute()


Execute - Method for execute query


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER = Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
Set Comm = Server.CreateObject("ADODB.Command")
Set Comm.CommandText = "DELETE FROM customer "
Comm.Execute()

CommandType - Method for create command type


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER = Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
Set Comm = Server.CreateObject("ADODB.Command")
Comm.CommandType = adCmdText OR adExecuteNoRecords

CommandTimeout - Properties for limit time execute.


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
Set Comm = Server.CreateObject("ADODB.Command")
Set Comm.CommandTimeout = 20

ActiveConnection - Properties for using active connection


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""

Set Conn2 = Server.Createobject("ADODB.Connection")
Conn2.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase2.mdb"),"" , ""

Set Comm = Server.CreateObject("ADODB.Command")
Comm.ActiveConnection=Conn

State - Properties for check connection status


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
Set Comm = Server.CreateObject("ADODB.Command")
Response.write Comm.State

Cancel - Method for cancel method


Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
Set Comm = Server.CreateObject("ADODB.Command")
Comm.Cancel
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.