Hello I still having problems, it brings me DBnull and I tried the Store procedure and works. This is my code. If someone could help me I will appreciate.
conexion.Open()
command.Connection = conexion
command.CommandText = "TraerPaisOrigen"
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@Cod_Dua", TxtCodDUA.Text)
command.Parameters("@Cod_Dua").Direction = ParameterDirection.Input
command.Parameters.AddWithValue("@_PaisOrigen", MySqlDbType.VarChar)
command.Parameters("@_PaisOrigen").Direction = ParameterDirection.Output
command.ExecuteNonQuery()
'XML_PaisOrigen is a String
XML_PaisOrigen = command.Parameters(0).Value.ToString
conexion.Close()
My Store Procedured
CREATE PROCEDURE TraerPaisOrigen( IN Cod_Dua INT, OUT _PaisOrigen VARCHAR(2))
This:
command.Parameters.AddWithValue("@Cod_Dua", TxtCodDUA.Text)
command.Parameters("@Cod_Dua").Direction = ParameterDirection.Input
should be this:
command.Parameters.AddWithValue("@Cod_Dua", CInt(TxtCodDUA.Text))
This:
command.Parameters.AddWithValue("@_PaisOrigen", MySqlDbType.VarChar)
command.Parameters("@_PaisOrigen").Direction = ParameterDirection.Output
should be this:
command.Parameters.Add("@_PaisOrigen", MySqlDbType.VarChar, 2).Direction = ParameterDirection.Output
This:
XML_PaisOrigen = command.Parameters(0).Value.ToString
should be this:
XML_PaisOrigen = command.Parameters(1).Value.ToString()