Jump to content

Archived

This topic is now archived and is closed to further replies.

Spyker

, erro ao utilizar o ExecuteNonQuery

Recommended Posts

Pessoal no ExecuteNonQuery ocorre uma exceção nao sei pq, alguem poderia me ajudar? Minha classe herda de outra os objetos command e conexao.Public Sub AlterarPerfilUsuario(ByVal cod_perfil_per As Int32, ByVal des_perfil_per As String) Try Me.conexao.Open() Me.sqlTran = Me.conexao.BeginTransaction Me.command.CommandText = "usp_fmu_AlterarPerfilUsuario" Me.command.Parameters.Add("@cod_perfil_per", SqlDbType.Int).Value = cod_perfil_per 'Me.command.Parameters("@cod_perfil_per").Direction = ParameterDirection.Input Me.command.Parameters.Add("@des_perfil_per", SqlDbType.NChar).Value = des_perfil_per 'Me.command.Parameters("@des_perfil_per").Direction = ParameterDirection.Input Me.command.Connection = Me.conexao Me.command.ExecuteNonQuery() Me.sqlTran.Commit() Catch ex As Exception Me.sqlTran.Rollback() Finally Me.conexao.Close() Me.command.Dispose() End Try End Sub

Share this post


Link to post
Share on other sites

Pessoal no ExecuteNonQuery ocorre uma exceção nao sei pq, alguem poderia me ajudar? Minha classe herda de outra os objetos command e conexao.Public Sub AlterarPerfilUsuario(ByVal cod_perfil_per As Int32, ByVal des_perfil_per As String) Try Me.conexao.Open() Me.sqlTran = Me.conexao.BeginTransaction Me.command.CommandText = "usp_fmu_AlterarPerfilUsuario" Me.command.Parameters.Add("@cod_perfil_per", SqlDbType.Int).Value = cod_perfil_per 'Me.command.Parameters("@cod_perfil_per").Direction = ParameterDirection.Input Me.command.Parameters.Add("@des_perfil_per", SqlDbType.NChar).Value = des_perfil_per 'Me.command.Parameters("@des_perfil_per").Direction = ParameterDirection.Input Me.command.Connection = Me.conexao Me.command.ExecuteNonQuery() Me.sqlTran.Commit() Catch ex As Exception Me.sqlTran.Rollback() Finally Me.conexao.Close() Me.command.Dispose() End Try End Sub

Qual o erro retornado?Se for uma SELECT, use somente o ExecuteQuery.Abraços

Share this post


Link to post
Share on other sites

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.