Greetings, i'm having a problem on inserting all my items from listview to my database using stored procedure. heres my code.

Dim lvItem As ListViewItem
       For Each lvItem In ListView1.Items

                With dbComm
                    .AddParameter("@details", lvItem.Text, SqlDbType.VarChar)

                    If .Success = False Then
                        MsgBox("Record failed to save.")
                        MsgBox("Record Saved.")
                    End If

Here's my code in stored proc

            INSERT INTO tblRecord (details)
            VALUES (@details)

Edited 2 Years Ago by christan: wrong inline code

See this example (con is the connection object)

    Dim cmd As New SqlCommand("", con)
    cmd.CommandType = CommandType.StoredProcedure
    cmd.CommandText = "InsertRecord"
    cmd.Parameters.Add("@Details", SqlDbType.VarChar)


    cmd.Parameters("@Details").Value = "Sample details 1"
    cmd.Parameters("@Details").Value = "Sample details 2"
    cmd.Parameters("@Details").Value = "Sample details 3"


Just replace the centre block (between con.Open and con.Close) with your loop.

Edited 2 Years Ago by Reverend Jim

hello i want to use microsoft access with using vb tell me how can i add data to access and see data from vb

This question has already been answered. Start a new discussion instead.