CLASS CONNECTION
Imports MySql.Data.MySqlClient
Public Class Conexion
Protected cnn As New MySqlConnection
Public idusuario As Integer
Protected Function conectado()
Try
cnn = New MySqlConnection("Server=localhost; Uid=root; Database=bdoperador")
cnn.Open()
Return True
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
Protected Function desconectado()
Try
If cnn.State = ConnectionState.Open Then
cnn.Close()
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
End Class
CLASS FCLIENTE
Public Class fcliente
Inherits Conexion
Dim cmd As New MySqlCommand
Public Function mostrar() As DataTable
Try
conectado()
cmd = New MySqlCommand("mostrar_cliente")
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = cnn
If cmd.ExecuteNonQuery Then
Dim dt As New DataTable
Dim da As New MySqlDataAdapter(cmd)
da.Fill(dt)
Return dt
Else
Return Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
Finally
desconectado()
End Try
End Function
End Class
My stored procedure is show_client
CREATE PROCEDURE mostrar_cliente()
BEGIN
SELECT * FROM cliente ORDER BY idcliente desc;
END
If I do it that way I get an error in the mysql Now if I believe it that way
CREATE PROCEDURE mostrar_cliente()
SELECT * FROM cliente ORDER BY idcliente desc;
I do not get an error but nothing happens in the form but if I make a select only for example
SELECT * FROM cliente ORDER BY idcliente desc
there if you upload the data to the form I'd like to know why it does not load the data when I do a procedure.