This is my code
Dim i As Integer = 0
For i = 0 To Me.SalesDataGridView.Rows.Count - 1
Dim connection As New SqlConnection("Data Source=ESSEL-PC;Initial Catalog=InventoryManager;Integrated Security=True")
Try
connection.Open()
Dim command As New SqlCommand("Insert Into Sales ItemID,ItemName,Unitprice,Quantity,TotalPrice)Values('" & Me.txtitemid.Text & "','" & Me.txtitemname.Text & "','" & Me.txtunitprice.Text & "','" & Me.txtquantity.Text & "','" & Me.lbltotalcost.Text & "'", connection)
command.ExecuteNonQuery()
Catch ex As Exception
End Try
Next
please help me out i need to insert all values from the datagrid into the database
thank
This post has been edited by PsychoCoder: 21 February 2010 - 10:59 AM
Reason for edit:: Code tags fixed :)

New Topic/Question
Reply




MultiQuote




|