another solution is create one new class items using it get and set values by property.
and in purchaseclass create generic variable of list of type item .
pass this values to item class.
In ur store procedure method iterate this values from list and pass to store procedure as parameter ..exampal
1.create item calss
public class Item
{
string name;
string lname
public Item(string name, string lname)
{
this.name = name;
this.lname = lname;
}
public string Name
{
get
{
return this.name;
}
}
public string MyLname
{
get
{
return this.lanme;
}
}
}
2.In listview page pass this values to items
purchase objpurchase =new purchase();
foreach (ListViewItem item in purchaseListView.Items)
{
value1 = item.SubItems[0].Text.ToString();
value2 = item.SubItems[1].Text.ToString();
objPuchase.Items.Add( new Item(value1,value2));
}
3.change ur purchase class create generic variable as public List of type Items class and iterate values from it.
public class purchase
{
public List<Item> Items;
double InvoiceTotal;
public Invoice()
{
Items = new List<Item>();
}
public void StoreProcedureMethos()
{
string name2;
string lanme2;
foreach (Item i in this.Items)
{
name2=i.Name;
lanme2=i.MyLname;
}
}
}
try it as demo ...change as per ur requirements