0
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Dim j As Integer
        
       
        Dim conn1 As New SqlConnection
       
        Dim cmd1 As SqlCommand
       
        Dim dp1 As New SqlDataAdapter
        
        Dim ds1 As New DataSet
        Dim str1 As String
        
        str1 = "Insert into  Feedback( Title,UserName,EmailId,Feedback,) Values('" & ((txtTitle.Text).Trim).ToUpper() & " ','" & ((UserName.Text).Trim).ToUpper() & " ','" & ((txtEmail.Text).Trim).ToUpper() & " ', '" & ((txtFeedback.Text).Trim).ToUpper() & " ')"
        conn1 = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True")
        conn1.Open()


        cmd1 = New SqlCommand()
        cmd1.CommandType = CommandType.Text
        cmd1.CommandText = str1



        cmd1.Connection = conn1
        Try

            j = cmd1.ExecuteNonQuery()
            If j = 0 Then
                MsgBox("jhgjh")
            Else

                MsgBox(j)
            End If

        Catch

        End Try


        'conn1.Close()


    End Sub

there is no error but when i print msgBox above the ccmd.ExecuteNonQuery it prints....but when i print after this line there is no processing.and the code is not working

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by crishjeny
0

set breakpoints and see whats going on and where does the execution fails:
Modify your catch like this:

Catch ex As Exception
  MsgBox(ex.Message)
End Try
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.