Can someone tell me what's wrong with this code ? whenever I run it , I don't get any error messages , but when I go and view the data in the table , I find nothing , Blank !
Code:Imports System.Data.SqlClient Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim conn As New SqlConnection conn.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\OperationDB.mdf;Integrated Security=True;User Instance=True" Dim cmd As New SqlCommand cmd.CommandText = "INSERT INTO COMPLAINS (NAME) VALUES ('TESTING')" cmd.Connection = conn conn.Open() cmd.ExecuteNonQuery() conn.Close() Catch MessageBox.Show(Err.Description) End Try End Sub End Class




Reply With Quote