I have problem creating a console vb.net program that executes a stored procedure in Oracle database. I can do this if the stored procedure will be hard coded in the code. The problem is, the stored procedure will need to be place in a parameter from vendor program. Currently, we use a VB6 program to do this. Now, they want to convert this vb6 program into .NET but I don't know how to do it. I tried the approach below but it doesn't pass the command parameter from the 3rd party program.

Example. This is the screenshot of the 3rd party program:

[![EXTERNAL PROGRAM](https://i.stack.imgur.com/tX505.jpg)](https://i.stack.imgur.com/tX505.jpg)

The PLSQLSUB.exe program is a vb6 that invokes stored procedure CNC\_UNLOCK\_USERS.

This is the VB6 code, this is currently working but I don't know how to pass the external parameter in VB.NET

```
Private Sub Form_Load()
  Dim cnTrecs As New ADODB.Connection
  Dim QY As New ADODB.Command

  Dim I As Integer

  Dim Procedures(10) As String

  Dim ColonPos As Integer

  Dim CommLine As String
  Dim CommLength As Integer
  Dim StartPos As Integer
  Dim FileName As String
  Dim CheckForFile As String
  Dim User As String
  Dim Pass As String
  Dim Userid As String
  Dim Password As String

  Dim PLSCount As Integer

  PLSCount = 0

  CommLine = Command()
  CommLength = Len(Trim(CommLine))

  If Trim(CommLine) <> "" Then
    StartPos = 1
    For I = 1 To 10
      ColonPos = InStr(StartPos, Trim(CommLine), ";")

      If ColonPos > 0 Then
        Procedures(I) = Mid(CommLine, StartPos, ColonPos - StartPos)
        PLSCount = PLSCount + 1
        StartPos = ColonPos + 1
      ElseIf I > 1 Then
        If (CommLength - StartPos) > 0 Then
          Procedures(I) = Mid(CommLine, StartPos, CommLength - StartPos)
          MsgBox (Procedures(I))
          PLSCount = PLSCount + 1
          Exit For
        Else
          Exit For
        End If
      Else
        Procedures(I) = Trim(CommLine)
        PLSCount = PLSCount + 1
        Exit For
      End If
    Next
    Exit Sub
  Else
    Unload Me
    Exit Sub
  End If

  CheckForFile = Dir("C:\VB\vbtext1.txt")
  If CheckForFile <> "" Then FileName = "d:\VB\vbtext1.txt"
    Open FileName For Input As #5   ' Open UserID and Password file.
      Line Input #5, Userid
      Line Input #5, Password
    Close #5
  End If
  User = Mid(Userid, 1) ' Set database userID
  Pass = Mid(Password, 1) ' Set database password

  cnTrecs.Open "DSN=PLSQLSUB;" _
                & "Uid=" _
                & Trim$(User) & ";PWD=" _
                & Trim$(Pass)

  For I = 1 To PLSCount ' Loop until end of plsql procedures
    Print #1, "The Stored Procedure " & Procedures(I) & " was submitted for execution     
on/at "; Format(Now, "dd-mmm-yyyy hh:mm:ss")

    Set QY.ActiveConnection = cnTrecs
    QY.CommandType = adCmdStoredProc
    QY.CommandText = Procedures(I)
    QY.Execute
    Print #1, "The Stored Procedure " & Procedures(I) & " completed execution on/at ";   
    Format(Now, "dd-mmm-yyyy hh:mm:ss")
    Print #1, " "
  Next I

  If cnTrecs.State = adStateOpen Then
    cnTrecs.Close
  End If
End Sub

```

A friend told me about using the below code but I could not able to pass the stored procedure. Any help will be greatly appreciated.

```
Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs

For i As Integer = 0 To CommandLineArgs.Count - 1
   MessageBox.Show("The stored procedure is: " + CommandLineArgs(i))
Next

```