Created On: 8 June 2010
Problem:
This example shows how to create and populate an ADO.NET Dataset in a VB.NET program and then pass the dataset as an argument to a COBOL .NET class.
Resolution:
The attached example PassDSVB.zip contains two .NET projects and a solution file.
The example was created using Visual Studio 2008 and Net Express 5.1.
Running the example requires that an instance of SQL Server be running and that the Northwind sample database be present.
Unzip the example to your hard drive C:\\ while retaining the folder structure in the .zip file.
You will end up with two folders:
C:\\PassDSVB and C:\\PassDSCOB
Start Visual Studio 2008 and open the solution file C:\\PassDSVB\\PassDSVB.sln
Select Build Solution from the Build menu.
Open up the source file PassDSVB.vb and view the code for the method Button1_Click.
The connection to SQL Server uses the Server alias ".".
Please change this if necessary to the instance name that you are using.
Step into the code using the F11 key and continue to press F11 to step through each line.
The dataset is created and populated in the VB program and then the COBReadDS method is called on an instance of PassDSCOB.Class1 and the dataset is passed as a parameter.
The COBOL method will read through the dataset and will output the rows read to a console window.
The example was created using Visual Studio 2008 and Net Express 5.1.
Running the example requires that an instance of SQL Server be running and that the Northwind sample database be present.
Unzip the example to your hard drive C:\\ while retaining the folder structure in the .zip file.
You will end up with two folders:
C:\\PassDSVB and C:\\PassDSCOB
Start Visual Studio 2008 and open the solution file C:\\PassDSVB\\PassDSVB.sln
Select Build Solution from the Build menu.
Open up the source file PassDSVB.vb and view the code for the method Button1_Click.
The connection to SQL Server uses the Server alias ".".
Please change this if necessary to the instance name that you are using.
Step into the code using the F11 key and continue to press F11 to step through each line.
The dataset is created and populated in the VB program and then the COBReadDS method is called on an instance of PassDSCOB.Class1 and the dataset is passed as a parameter.
The COBOL method will read through the dataset and will output the rows read to a console window.
Incident #2355371
Attachments
Old KB# 31161