insert into table in vb.net

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi i have created a table and when i insert values in it through program, values are not getting inserted. The below is my program. Please let me know how to correct this issue.Private Sub insert_into(dbname)
Dim con As New SqlConnection
Dim command As New SqlCommand
Using connection As New SqlConnection("Data Source=(local);Integrated Security=True;Initial Catalog=" & dbname & ";")
connection.Open()
Try

command.Connection = connection
command.CommandText = "INSERT INTO dbname([column1], [column2],[column3],[column4],[column6],[column7],[column8],[column9],[column10]) VALUES([10], [syed],[arafath],[10.1],[abul],[hasan],[abdullah],[ahmed],[sam],[feli])"
command.ExecuteNonQuery()


Catch ex As Exception
MessageBox.Show("Records not inserted")
Finally
connection.Close()
End Try
End Using
End Sub
Regards Syed

View the full article
 
Back
Top