|
Hi I am working with msvs 8 with linq and datagridview I have been working in this problem for the last 4 days. It is becoming like gambling. The more time I spend on it the more I insist to solve it. ------ I have a table named "Contract" indexed by ContractNumber I have an add button and save button. If the record is not newly inserted, the save button works fine. But for newly inserted ContractNumber I have problems as described down below the code. The add button opens a dialog form, which collects only the contract number from the user. All remaining entries are supposed to be made directly into the datagridview after checking that the contract number does not exist in the table. the add push button ---------------- conttract = new Contract(); contract.ContractNumber = contractDialog.ContractTextBox.Text.ToString(); dbContext.Contracts.InsertOnSubmit(cont); Validate(); dbContext.SubmitChanges(); the save push button _________________ Validate(); dbContext.SubmitChanges(); the problem I am facing is when I enter for example the contractor name or description into the grid cell, and click the save PB, the cell immediatly goes blank and I lose the entry. When I try for a second time, it works and the entry makes it to the database. Why do I lose the entry the first time? I will appreciate any help |