RitaAndrade Posted August 13, 2013 at 02:36 PM Report #521617 Posted August 13, 2013 at 02:36 PM (edited) Boa tarde... Estou com um problema, sem fim á vista já tentei de varia formas e não consigo por a funcionar. 'idP é um código que tenho q guardar conexao.Open() Dim contarREGAC As New SqlCommand("EXEC sp_existe_ANIMALCOR @IDcor='" & pelagemComboBox.SelectedValue & "', @IDanimal='" & idP.ExecuteScalar & "'", conexão) Dim contarREGAC1 As Integer = contarREGAC.ExecuteScalar ' Se não existem registos na bd então guarda If contarREGAC1 = 0 Then Dim REGC As New SqlCommand("EXEC sp_inserir_ANIMALCOR @IDanimal='" & idP.ExecuteScalar & "', @IDcor='" & pelagemComboBox.SelectedValue & "'", conexão) End If conexao.Open() O problema está na linha Dim REGC As New SqlCommand("EXEC sp_inserir_ANIMALCOR @IDanimal='" & idP.ExecuteScalar & "', @IDcor='" & pelagemComboBox.SelectedValue & "'", conexão) quando clico no botao guardar ele passa por ai mas não guarda nada, e no sql server o insert está a funcionar Edited August 13, 2013 at 02:39 PM by RitaAndrade
nelsonr Posted August 13, 2013 at 03:02 PM Report #521620 Posted August 13, 2013 at 03:02 PM Boas, o problema está que estás a definir um comando, mas não estás a executar. Na linha seguinte à definição do REGC, adiciona isto: REGC.ExecuteNonQuery() Já agora, no fim tens novamente conexao.Open(), não sei se o que pretendes é .Close() 1 Report
RitaAndrade Posted August 13, 2013 at 03:21 PM Author Report #521627 Posted August 13, 2013 at 03:21 PM loool básico -.- Muito obrigada
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now