1. 程式人生 > >asp.net匯入Excel表

asp.net匯入Excel表

{
                    
float MaterialPrice =0.0f;
                    
float MaterialTaxPrice =0.0f;
                    
float TaxRate =0.0f;
                    
float Moneys =0.0f;
                    
int temp=0;
                    
if (row["單價"].ToString().Trim() !="")
                        MaterialPrice 
=float.Parse(row[
"單價"].ToString().Trim());
                    
if (row["含稅單價"].ToString().Trim()!="")
                        MaterialTaxPrice
=float.Parse(row["含稅單價"].ToString().Trim());
                    
if (row["稅率"].ToString().Trim()!="")
                        TaxRate
=float.Parse(row["稅率"].ToString().Trim());
                    
if (row["金額"].ToString().Trim()!="")
                        Moneys
=float.Parse(row["金額"].ToString().Trim());

                    
if (material.SelectMaterialsDynamic("MaterialID='"+ row["物料長程式碼"].ToString() +"'""").Rows.Count <=0//不存在,其實可以不要,因為編號是主鍵,如果相同則插不進去
                        temp = material.InsertMaterial(row[
"物料長程式碼"].ToString(), row["物料名稱"].ToString(), row["單位"].ToString().Trim(), MaterialPrice, MaterialTaxPrice, TaxRate, Moneys, 0);
                    
else
                        NotIntoID 
+= row["物料長程式碼"].ToString()+",";
                    
if (temp >0)
                            index 
+= temp;
                     temp 
=0;
                }