The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property...

8
The Tip of the ADO-burg Francisco H Tapia

Transcript of The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property...

Page 1: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

The Tip of the ADO-burg

Francisco H Tapia

Page 2: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

Ado Objects

Command Connection Error Parameter

Property Record RecordSet Stream

Page 3: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

Who’s your provider?

Page 4: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

Connection providers…

OLEdb providers– JET– SQL– TEXT– XML– mySQL– Etc…

Page 5: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

What’s in a command?

Excute stored procedures or queries where a result is not expected back

– .Execute , , adExecuteNoRecords

Pass multiple parameters– .Parameters.Append .CreateParameter("CompanyName", _ adVarWChar,

adParamInput, 50, sCompanyName)– .Parameters.Append .CreateParameter("ContactFirstName", _ adVarWChar,

adParamInput, 30, sContactFirstName)– .Parameters.Append .CreateParameter("ContactLastName", _ adVarWChar,

adParamInput, 50, sContactLastName)

Receive a return a single pice of data instead of a recordset…–     .Parameters.Append .CreateParameter("RETURN_VALUE", _ adInteger,

adParamReturnValue, 0) –     ' Print new identity value     Debug.Print .Parameters("job_id").Value  ' New

Identity

http://www.able-consulting.com/ADO_Faq.htm

Page 6: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

Recordsets…

Conn.stp_MyStoredProcedure Param1, rs– Store Access queries in MDB BE– Create an updateable recordset on the fly

OR Use the Command object to execute the

procedure.– Set rs = cmd.execute

Page 7: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

Dispelling myths…

ADO is Faster! Not necessarily, while DAO is optimized for JET, ADO is optimized to take advantage of a whole slew of languages. In reality if you are planning to process thousands of JET records in code, you should look at DAO instead of ADO. SQL for example is using an optimized OLEdb provider vs the ODBC provider, thus ADO is the current supported data access model.

ADO requires less code The object model is is flatter thus requiring less coding…

MS Access 97 cannot use ADO code

False. ADO can be added as a reference in code, and executed the same way in Access 97 as you can in Access 2000/2002. Intellisense is not aware of the ADO library though.

Page 8: The Tip of the ADO-burg Francisco H Tapia. Ado Objects Command Connection Error Parameter Property Record RecordSet Stream.

LINKS!!!

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmscadoprogrammersguide.asp

http://www.able-consulting.com/ADO_Faq.htm http://www.devguru.com/technologies/ado/quickref/ado_index.html http://www.vbsquare.com/databases/begado/\ www.google.com