hi
this is my coding i run no error message but the data is not inserted in the table. i need help what is error in this program

Dim MyConnection As New SqlClient.SqlConnection
Dim MyCommand As New SqlCommand
Dim connstring As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Documentcreation.mdf;Integrated Security=True;User Instance=True"
Dim insstr As String = ""
Dim disp As Integer
MyConnection.ConnectionString = connstring
MyCommand.Connection = MyConnection
MyConnection.Open()
Dim rs As Date = Today
If MyConnection.State = ConnectionState.Open Then
MyCommand = New SqlCommand("insert into prak values (2,'" & txtdevelopercode.Text & "')", MyConnection)
disp = MyCommand.ExecuteNonQuery()
End If
MsgBox("Succesfully saved…")
MyConnection.Close()

Hi,

The code works fine for me. What is the error that you are getting while inserting the record? Is that any error related to SQL Client?
Please post the error that you are facing and also do not forget to use code-tags while posting codes.

Thank you

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.