用DateSet保存数据并插入到数据库
private void update(byte[] img)
{
string sql = "select top 0 * from V_KM_LIS_Report";
sqlOpr opr = new sqlOpr();
DataSet ds = opr.backds("CSKingMed", sql);
DataTable dtImg = ds.Tables[0];
DataRow dr = dtImg.NewRow();
dr["F_ReportBarCode"] = "0001";
dr["F_RequestCode"] = "0001";
dr["F_ExtContent"] = img;
dr["F_ExtType"] = "1";
dr["F_IndexNo"] = "1";
dtImg.Rows.Add(dr);
SqlConnection conn = opr.GetConn("CSKingMed");
SqlBulkCopy bulkCopy = new SqlBulkCopy(conn);
ds.Tables[0].TableName = "V_KM_LIS_Report";
bulkCopy.DestinationTableName = ds.Tables[0].TableName;
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
bulkCopy.ColumnMappings.Add(ds.Tables[0].Columns[i].ColumnName, ds.Tables[0].Columns[i].ColumnName);
}
conn.Open();
bulkCopy.WriteToServer(ds.Tables[0]);
conn.Close();
}