Adding a new row
-
Hi, I have a problem creating a new row in my first database project, using ADO .NET. When I remove the call to AddSummaryRow, UpdateDatabase yields no error, but when it's there, I get an System.Format Exception "Input string was not in a correct format". Do you guys have any idea of what the problem is?
private void UpdateCurrentRow() { currentRow = acp2DataSet.Summary.FindBySerial_Number(serialNumber); if(currentRow == null) { acp2DataSet.Summary.AddSummaryRow("None", "Unassigned", serialNumber); UpdateDatabase(); } } public void UpdateDatabase() { acp2DataAdapter.Update(acp2DataSet.Summary); }
-
Hi, I have a problem creating a new row in my first database project, using ADO .NET. When I remove the call to AddSummaryRow, UpdateDatabase yields no error, but when it's there, I get an System.Format Exception "Input string was not in a correct format". Do you guys have any idea of what the problem is?
private void UpdateCurrentRow() { currentRow = acp2DataSet.Summary.FindBySerial_Number(serialNumber); if(currentRow == null) { acp2DataSet.Summary.AddSummaryRow("None", "Unassigned", serialNumber); UpdateDatabase(); } } public void UpdateDatabase() { acp2DataAdapter.Update(acp2DataSet.Summary); }
Sounds like you have an data type error. It mihgt be that your trying to input a double, or decimal, or other number format into a string or vise versa. Make sure that your inputs are the same data type as method your inputing them into. Example: Private void UpdateRow(argument1 as string) you cant input an integer as argument1 because its supposed to be a string.