SAMPLE: Spvjado Demonstrates Using Stored Procedures from WFC/ADO/Java (206452)



The information in this article applies to:

  • Microsoft Visual J++ 6.0
  • ActiveX Data Objects (ADO) 2.7
  • ActiveX Data Objects (ADO) 2.0
  • ActiveX Data Objects (ADO) 2.1
  • ActiveX Data Objects (ADO) 2.1 SP2
  • ActiveX Data Objects (ADO) 2.5
  • ActiveX Data Objects (ADO) 2.6

This article was previously published under Q206452

SUMMARY

The Spvjado.exe sample demonstrates using the SQL Server stored procedures from the WFC ADO Java classes. The sample also contains the adoCon class, which is a complete set of the ADO version 2.0 enumerated types as described in the ADO documentation.

MORE INFORMATION

The following files are available for download from the Microsoft Download Center:
Release Date: Mar-08-1999

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
SpVJado.exe contains the following files:

File Name Size
adoCon.java 14,680
spVJado.sln 511
spVJado.vjp 4,562
WFCadoSP.java 15,305
Readme.txt 4,000


Upon startup, the sample creates two stored procedures:
  • The first stored procedure is sp_AdoVJin, which takes an input parameter (money) and returns a recordset.
  • The second stored procedure is sp_AdoVJinOutRtn, which also takes a input parameter but includes a output parameter and a return parameter as well.
The sample demonstrates how you must close the returned ADO recordset before you can access the output and return parameters.

The sample also demonstrates ADO's automatic and manual parameter population methods. Each stored procedure uses the value in the edit box next to the label "Sel > Price" as the input parameter. The default value of the edit box is $9.99, but you can enter any value. The "spIN" button opens a forward-only, read-only recordset with the stored procedure sp_AdoVJin.

The "spInOutRtn" button opens a forward-only, read-only recordset with the stored procedure sp_AdoVJinOutRtn. Once you navigate past the end of the recordset (via the Next button), the output and return parameters are displayed.

The spIN2 button opens a read/write recordset using the sp_AdoVJin stored procedure.

In order to successfully compile and run this sample, you need to change the name of SQL Server in connection string in this call:
 m_conn.setConnectionString("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=YOUrSQlSERVER"); 


Note that the constant identifiers in the class adoCon are the same constant names used in Visual Basic and Visual C++. Although WFC/ADO includes all the ADO constants in the com.ms.wfc.data.AdoTypes class, WFC does not use the same constant names as ADO; this can be confusing for some programmers. For example, from Visual Basic, Visual C++, or the ADO documentation, to choose a client cursor you would use the "adUseClient" constant; however, in WFC you would use "AdoEnums.CursorLocation.CLIENT". If you use adoCon, you can use the same ADO constant names in Visual J++ as you use in Visual C++ or Visual Basic.


Modification Type:MinorLast Reviewed:8/9/2004
Keywords:kbdownload kbDatabase kbinfo KB206452