Consultor Eletrônico



Kbase P140722: How to create a SQL-92 stored procedure using VB.NET
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   13/07/2010
Status: Unverified

GOAL:

How to create a SQL-92 stored procedure using VB.NET

GOAL:

Can you create a stored procedure via code using VB.NET?

FACT(s) (Environment):

Windows
OpenEdge 10.x

FIX:

The following code fragment shows how to create a simple stored procedure using VB.NET:


Dim SQLConnection As New OdbcConnection("DSN=test;UID=user;PWD=pass")

Dim StoredProc As String
StoredProc = "CREATE PROCEDURE hello_world (OUT out_name char(20))" + Chr(13) + Chr(10)
StoredProc += " BEGIN" + Chr(13) + Chr(10)
StoredProc += " out_name = ""helloworld""; " + Chr(13) + Chr(10)
StoredProc += " END" + Chr(13) + Chr(10)

SQLConnection.Open()

Dim SQLCommand As New OdbcCommand(StoredProc, SQLConnection)

SQLCommand.ExecuteScalar()

SQLConnection.Close()