Hello all
thanks every one who has posted for my question.
this is what i have done and now it's working fine without any problem all 4 operation insert, delete, update, and search with stored procedure.
but only one thing i dont understand when i started this assignment i just drag and drop sqlcommand and sqlconnection but it was not working and then i have removed those two and add this
Private Sub InsertData()
<pre> Try
Dim Con As New SqlConnection
Con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=" & MyString & "\TrialDataBase.mdf;Integrated Security=True;User Instance=True"
Dim cmd As New SqlCommand("NewInsertCommand", Con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@FirstName", SqlDbType.NVarChar).Value = FirstName.Text
cmd.Parameters.Add("@LastName", SqlDbType.NVarChar).Value = LastName.Text
cmd.Parameters.Add("@City", SqlDbType.NVarChar).Value = ComboBox1.SelectedItem.ToString
cmd.Parameters.Add("@State", SqlDbType.NVarChar).Value = ComboBox2.SelectedItem.ToString
Con.Open()
cmd.ExecuteNonQuery()
MsgBox("Data Saved Successfully !", MsgBoxStyle.Information)
Con.Close()
FirstName.Clear()
LastName.Clear()
Catch ex As SqlException
MsgBox(ex, MsgBoxStyle.Critical)
End Try
End Sub
but anyway it's done and dusted but i still want to know why drag and drop dosen't work
thanks again
have a nice day