Jump to content

problema com public function [Resolvido]


Recommended Posts

bem pessoal eu tenho um problemazinho.

eu quero criar uma public function num modulo.

a função é a seguinte:

Public Function InserirVisitas()
        Dim sql As String = "insert into TBVisitas (Cliente, Data, Descr, PData, PDescr, Utilizador, DtHrMov, UtilizadorAlter, DtHrMovAlter) VALUES (@Cliente, @Data, @Descr, @PData, @PDescr, @Utilizador, @DtHrMov, @UtilizadorAlter, @DtHrMovAlter)"
        Dim SqlConn As New SqlConnection(ConnStr)
        Dim cmd As New SqlCommand(sql, SqlConn)

        cmd.Parameters.AddWithValue("@Cliente", FRMVisitas.TXTClie.Text)
        cmd.Parameters.AddWithValue("@Data", FRMVisitas.DTVis.Value)
        cmd.Parameters.AddWithValue("@Descr", FRMVisitas.TXTDescrVis.Text)
        cmd.Parameters.AddWithValue("@PData", FRMVisitas.DTPVis.Value)
        cmd.Parameters.AddWithValue("@PDescr", FRMVisitas.TXTDescrPVis.Text)
        Dim util As String = "eu"
        cmd.Parameters.AddWithValue("@Utilizador", util)
        cmd.Parameters.AddWithValue("@DtHrMov", Date.Now)
        cmd.Parameters.AddWithValue("@UtilizadorAlter", util)
        cmd.Parameters.AddWithValue("@DtHrMovAlter", Date.Now)


        Dim reader As SqlDataReader = cmd.ExecuteReader

        SqlConn = Nothing
        cmd = Nothing
        MsgBox("Visita inserida com exito!")

        Call LimparTXT(FRMVisitas)
        Call LimparCB(FRMVisitas)

    End Function

mas isto dame um warning por causa de não retomar nenhum  valor. como poderei eu resolver isto este warning?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.