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

Recommended Answers

All 2 Replies

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.