0

I have a datagridview being populated by a database, when trying to store the values in the back end, the string values are being stored but the numeric values are being store as null or "" even when using different datatypes.

        string aa = dataGridView1.Rows[0].Cells[0].Value as string;
        string ab = dataGridView1.Rows[0].Cells[1].Value as string;
        double? ac = dataGridView1.Rows[0].Cells[2].Value as double?;
        string ad = dataGridView1.Rows[0].Cells[3].Value as string;
        string ae = dataGridView1.Rows[0].Cells[4].Value as string;

        MessageBox.Show(aa + " " + ab + " " +  ac + " " + ad + " " + ae);

enter image description here enter image description here

Thanks

EDIT: Ive just noticed, the last 3 columns are all numeric values in the DB, maybe it has something to do with that. Maybe you need to do a different type of casting?

Adam
  • 35
  • 1
  • 7

0 Answers0