i use Sybase database. in this database is procedure, which have many inputs but no readable output. procedure after commit only send msgbox to client.
Myprocedure(
in a_ID IDINT,
in a_OPERACE NAZEVSTR,
in a_UZIVATEL JMENOSTR,
in a_DATUM DATUMTS_NU,
in a_PARAM1 VALUESTR,
in a_PARAM2 VALUESTR,
in a_PARAM3 VALUESTR,
in a_KOMENTAR KOMENTARTXT
) returns void
and
perform admin_eng.ENG_ShowMessage( ...
i cannot change this procedure, because i dont have acces to it :-D
on other side, i have VB.NET aplication, with this aplication i call this procedure, and this procedure return me classics windows messagebox with result. i want catch this messagebox, Suppress this messagebox, and save result to variable.
Try
Dim cn As New System.Data.Odbc.OdbcConnection()
cn.ConnectionString = "DRIVER={Adaptive Server Anywhere 9.0};ENG=ASA9;DBN=ASWINFO;Uid=" & dbuzivatel & ";Pwd=" & dbuzivatelheslo & ";Links=tcpip(Host=mydb.cz);"
cn.Open()
Dim cmd As New System.Data.Odbc.OdbcCommand()
AddHandler cn.InfoMessage, AddressOf cn_InfoMessage
cmd.CommandType = CommandType.Text
cmd.Connection = cn
cmd.CommandText = "call Myprocedure(
a_ID = '" & id & "',
a_OPERACE = '" & nazevbk & "',
a_UZIVATEL = '" & uzivatel & "',
a_DATUM = '" & datum & "',
a_PARAM1 = '',
a_PARAM2 = '',
a_PARAM3 = '')
"
cmd.ExecuteNonQuery()
cn.Close() : cn.Dispose()
Catch odbcex As System.Data.Odbc.OdbcException
Dim err As System.Data.Odbc.OdbcError
For Each err In odbcex.Errors
MessageBox.Show(err.Message)
Next
End Try
any ideas how to catch this infomessage? try/catch work only on error messages, my handler for infomessage dont catch this event. i dont know how to ?-/