No Original data to access.

Dreamer

New member
Joined
Mar 8, 2003
Messages
3
Im working with access database.I have 3 tables with relations.
When i insert / update records it throws an exception:

System.Data.VersionNotFoundException: There is no Original data to access.

Whats wrong? Ive read somewhere thats a bug.
 
code

Here is a code:

C#:
// FormMain

FormEntry frmEntry = new FormEntry();
//dgEntry - datagrid
//parameter - row in DataView vueInvoice which i want edit
frmEntry.Show(vueInvoice[dgEntry.CurrentRowIndex]);
frmEntry.Dispose();

from FormMain I open FormEntry with row which i want edit

C#:
//FormEntry

public void Show(DataRowView Invoice)
{
    drvInvoice = Invoice;
    drInvoice = (DataSetIndustry.InvoiceRow) drvInvoice.Row;
    dsIndustry = (DataSetIndustry)drInvoice.Table.DataSet;

    if (this.ShowDialog() == DialogResult.OK)
    {
        if (drInvoice.RowState != DataRowState.Detached)
            drvInvoice.BeginEdit();

        drvInvoice["InvoiceID"] = Convert.ToInt32(txtInvoice.Text);
        drvInvoice["Date"] = Convert.ToDateTime(txtDate.Text);
        drvInvoice["SupplierID"] = (int)cbSupplier.SelectedValue;
        drvInvoice["DPH"] = (byte) cbDPH.SelectedValue;

        drvInvoice.EndEdit();
    }
    else
    {
        if (drInvoice.RowState == DataRowState.Detached)
            drvInvoice.CancelEdit();
    }
}

//add new supply
DataRowView drvNewSupply = vueSupply.AddNew();
FormSupply frmSupply = new FormSupply();

if (drInvoice.RowState == DataRowState.Detached)
{
    //set InvoiceID - relation
    drvInvoice["InvoiceID"] = Convert.ToInt32(txtInvoice.Text);
    drvInvoice.EndEdit();
}

frmSupply.iInvoiceID = drInvoice.InvoiceID;
frmSupply.Show(drvNewSupply);
frmSupply.Dispose();

everything works ok.But if I when I open FormSupply with next method and I add new Supply and close FormEntry it throws exception

C#:
//FormSupply
public void Show(DataRowView Supply)
{
    DataRowView drvSupply = Supply;
    drSupply = (DataSetIndustry.SupplyRow) drvSupply.Row;
    dsIndustry = (DataSetIndustry) drSupply.Table.DataSet;

    if (this.ShowDialog() == DialogResult.OK)
    {
        if(drSupply.RowState != DataRowState.Detached)
            drvSupply.BeginEdit();
        else
            drSupply.InvoiceID = iInvoiceID;

        drvSupply["Class"] = (string) cbClass.SelectedValue;
        drvSupply["Gross"]= (byte) cbGross.SelectedValue;
        drvSupply.EndEdit();
    }
    else
    {
        if (drSupply.RowState == DataRowState.Detached)
	drvSupply.CancelEdit();
    }
}

it seems that I lost some bindings.
 
Back
Top