我正在尝试使用对代码所做的更改来更新Access数据库,我将行上载到DataSet表,并且在调试会话期间它显示数据,但是一旦我关闭了应用程序,Access数据库便保持为空。
任何帮助将不胜感激。...完全讨厌Access数据库O〜O。 这是我的代码:
private void CreateTable()
{
//Creates a reference of the DataTable and Add the Columns
DataSets.ShippingUpdateDataSet.ShippingDataTable myTable = new DataSets.ShippingUpdateDataSet.ShippingDataTable();
DataSets.ShippingUpdateDataSet dataset = new DataSets.ShippingUpdateDataSet();
//The row to be inserted
object[] newRow;
//Creates references to the Classes that hold the data to be added to the DataTable
CustomerComplaint customerComplaint = new CustomerComplaint();
ShippingData shippingData = new ShippingData();
//Loop through the Lists to find matches on the order numbers and add it to the table as a new Row
for(int a = 0; a < shippingData.ShippedOrderDates.Count; a++)
{
for(int b = 0; b < customerComplaint.CustomerOrdersNumber.Count; b++)
{
if(shippingData.ShippedOrderNumbers[a] == customerComplaint.CustomerOrdersNumber[b])
{
newRow = new object[] {shippingData.ShippedOrderDates[a], shippingData.ShippedOrderNumbers[a],
shippingData.ShippedOrderCounts[a], customerComplaint.CustomersOrdersCount[b] };
dataset.Shipping.LoadDataRow(newRow, true);
}
else
{
newRow = new object[] {shippingData.ShippedOrderDates[a], shippingData.ShippedOrderNumbers[a],
shippingData.ShippedOrderCounts[a], 0 };
dataset.Shipping.LoadDataRow(newRow, true);
}
}
}
dataset.AcceptChanges();
}