I am using% co.de% of .Net to create a project as a learning base for BD with C #. I chose an easier way that would be to work most of the time in design mode through dataAdapters
. The battle I face is to insert the current date into a DB field. The following code works fine with strings for the text fields and Datasets
for the foreign key fields:
orcTableAdapter.Insert(Int32.Parse(comboBox2.ValueMember),datatime.Now, 0,Int32.Parse(comboBox1.ValueMember));
orcTableAdapter.Update(vorc2DataSet.Orcamento);
vorc2DataSet.AcceptChanges();
orcTableAdapter.Fill(vorc2DataSet.Orcamento);
I know there are ways to convert through int
but I do not know how to adapt to this format without having to change all the code.
The exception message follows:
An unhandled exception of type System.FormatException occurred in mscorlib.dll
Additional information: The input string was not in a correct format.