Visual Basic .NET samples

Directory: sqllib\samples\.NET\vb.

Table 1. Sample Visual Basic .NET program files that deal with database level objects.
Sample program name Program description
DbAuth.vb How to grant/display/revoke authorities at the database level.
DbDatAdp.vb How to use a DB2DataAdapter.
DbDatMap.vb How to set up DataTable and DataColumn mappings.
DbDsetCn.vb How to add existing constraints to a DataSet.
DbEvent.vb How to handle DB2DataAdapter events.
DbUse.vb How to use database objects.
DbValue.vb How to obtain a single value from a database.
Table 2. Sample Visual Basic .NET program files that deal with table objects.
Sample program name Program description
TbConstr.vb How to work with table constraints.
TbInfo.vb How to get and set information at a table level.
TbPriv.vb How to grant/display/revoke table level privileges.
TbSel.vb How to select from each of: insert, update, delete.
TbTrig.vb How to use a trigger on a table.
TbUse.vb How to manipulate table data and connect to/disconnect from a database.
Table 3. Sample Visual Basic .NET program files that deal with data types.
Sample program name Program description
DtLob.vb How to use the LOB data type.
Table 4. Sample Visual Basic .NET program files that demonstrate stored procedures.
Sample program name Program description
SpCat.db2 Drops and creates the procedures implemented in SpServer.vb.
SpClient.vb Client program used to call the stored procedures in SpServer.vb.
SpCreate.db2 Creates the external procedures implemented in SpServer.vb.
SpDrop.db2 Drops the external procedures created in SpCreate.db2.
SpReturn.vb Client application that calls the stored procedure EMP_DETAILS and obtains its return value.
SpServer.vb Visual Basic .NET external code implementation of procedures created in SpCat.db2.
EmpDetails.db2 CLP script that creates a stored procedure named EMP_DETAILS.
Table 5. Sample Visual Basic .NET program files that demonstrate user-defined functions.
Sample program name Program description
UdfCat.db2 Drops and creates the external UDFs implemented in UdfSrv.vb.
UdfCli.vb Client application that calls the user-defined functions in UdfSrv.vb.
UdfCreate.db2 Creates the external UDFs implemented in UdfSrv.vb.
UdfDrop.db2 Drops the external UDFs created in udfcreate.db2.
UdfSrv.vb User-defined scalar functions called by UdfCli.
Table 6. Sample Visual Basic .NET program files that demonstrate XML features
Sample program name Program description
XmlIndex.vb Create an index and use it in an XQuery.
XmlUniqueIndexes.vb Create an index with UNIQUE and VARCHAR length constraints.
XmlInsert.vb Insert an XML document into a column of XML data type.
XmlUpAndDel.vb Update and delete XML documents in the tables.
XmlRead.vb Read XML data stored in tables.
XmlRelToXmlDoc.vb Create an XML document directly from data stored in relational tables using SQL/XML publishing functions.
XmlRelToXmlType.vb Create an XML document from relational and XML data using SQL/XML publishing functions.
XmlToTable.vb Insert the data from an XML document into relational tables using SQL/XML.
XmlDecomposition.vb Decompose data stored in an XML file and insert the data into tables.
XmlSchema.vb Register the XML schema to the database and use the registered schema to validate and insert and XML document.
XmlFlwor.vb Use the XQuery FLWOR expression.
XmlSQLXQuery.vb Use SQL/XML queries
XmlXPath.vb Run simple XPath queries.
XmlXQuery.vb Execute nested XQuery FLWOR expressions.
XmlSimpleProcClient.vb Client application that calls the stored procedure.
XmlSimpleProc.vb Stored procedure functions built and run on the server.
XmlSimpleProcCreate.db2 CLP script to issue CREATE PROCEDURE statement.
XmlSimpleProcDrop.db2 CLP script to drop stored procedure from the catalog.
XmlXQueryProcClient.vb Client application that calls the stored procedure.
XmlXQueryProc.vb Stored procedure functions built and run on the server.
XmlSpCatXQuery.bat Batch file that first calls XmlXQueryProcDrop.db2 and then callsXmlXQueryProcCreate.db2. This file will be found only on windows platforms.
XmlXQueryProcCreate.db2 CLP script to issue CREATE PROCEDURE statement.
XmlXQueryProcDrop.db2 CLP script to drop stored procedure from the catalog.
Table 7. Sample Visual Basic .NET program files related to loosely coupled transactions.
Sample program name Program description
empcat.bat Catalogs the stored procedure EMP_DETAILS for the client program, SpReturn.
LCTrans.vb Demonstrates loosely coupled transactions.
regCOM.bat Registers COM+ objects for the LCTrans program.
RootCOM.vb This file is used to create a library assembly RootCOM.dll. LCTrans.vb refers to the classes and methods that are defined in this file.
SubCOM.vb This file is used to create a library assembly SubCOM.dll. LCTrans.vb refers to the classes and methods that are defined in this file.