top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to save from Listview to MS SQL Server?

+3 votes
492 views
How to save from Listview to MS SQL Server?
posted Mar 5, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim con As New SqlConnection(InvoiceClass.GetConnectionString()) ' My Connection String
        con.Open()
        For Each item As ListViewItem In Lstview.Items
            Dim command As SqlCommand = New SqlCommand("SP_InvoiceSave", con)
            command.Parameters.AddWithValue("@ItemName", item.SubItems(0).Text)
            command.Parameters.AddWithValue("@Qty", item.SubItems(1).Text)
            command.Parameters.AddWithValue("@SellingPrice", item.SubItems(2).Text)
            command.CommandType = CommandType.StoredProcedure
            command.ExecuteNonQuery();
        Next
        MsgBox("done")
        conn.Close()
    End Sub
answer Nov 20, 2014 by Manikandan J
Similar Questions
+4 votes

How can I save image in SQL SERVER by VB.NET?

+10 votes

I have 15-20 tables and i want to export the data from those tables to excel.

+4 votes

How to retrieve data from SQL Server multiple tables to Excel multiple sheets?

...