Hello,
Im connecting to an excel spreadsheet that looks like this:
LEVEL VALUE
None 0
Some 1.2
More 3
I create a data set:
System.Data.
DataSet ds = new System.Data.DataSet();then I fill it.
cmd =
new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", cn);cn.Open();
cmd.Fill(ds);
cn.Close();
Then:::::::::::::::::::::::::::::::::::
DataTable tbl = ds.Tables[0]; for (int i = 0; i < tbl.Rows.Count; i++)
{
DataRow myRow = tbl.Rows[i]; string name = (string)myRow["LEVEL"]; double values = (double)myRow["VALUE"]; }------------The problem-----------------------
Its getting the new string value of name for each row, but its returning 0 for each values row.
I tried to change values from a double to a text column in excel, it still said your bringing in a double.
HELPLPPPPPPPPPPPPPP!
Thanks
Matthew CoxPosted Jan 13, 2008, 12:14 AM
I didn't see it in the code you gave us and if that piece wasn't set up correctly then your adapter would not be able to fill the DataSet because you have no actual connection.
Although this may not even be the problem, I just don't want to "check the hardware before I determine if it's plugged in." ;)