上面的问题问的有点二,第一次用泛型集合,所以有点蒙,实际上lst[index].storage 就可以了。
本人解决了:
public int Add(List lst)
{
int res = 0;//受影响行数
for (int i = 0; i
{
strSQL = "INSERT INTO Storage(StorageNo,ProductNo, Quantity,Cost,TagPrice,StoragePerson,StorageTime,State,Supplier,Note) VALUES("" + lst[i].StorageNo + "","" + lst[i].ProductNo + "","" + lst[i].Quantity + "","" + lst[i].Cost + "","" + lst[i].TagPrice + "","" + lst[i].StoragePerson + "","" + lst[i].StorageTime + "","" + lst[i].State + "","" + lst[i].Supplier + "","" + lst[i].Note + "")";
res += sqlDBHelper.ExecuteNonQuery(strSQL);
sqlDBHelper.GetConn();
}
return res;
}