P
Phill
I have a table that contains 7 row of data with 8 columns. The columns
contain decimal data. Looks like this:
1 .5 .5 0 0 0 0 0 0
2 .25 .25 .25 0 0 0 0 0
etc.
The first column tells me how many points and I will use this as my index in
the array. I want to load this table into an array to be used in some
calculations and i don't want to have to read the database everytime they
change the number of points to calculate. I am new to c# and am having a lot
of trouble declaring my array and populating it. This is what I have so far
but it won't compile because the array is defined wrong..I think??? Please
help.
_conn = new
SqlCeConnection(PocketRigger.LocalStorage.ConnectionString);
string sSQL = "SELECT ULD_Number1, ULD_Number2, ULD_Number3,
ULD_Number4, ULD_Number5, ULD_Number6, ULD_Number7, ULD_Number8,
NumberOfPoints FROM tblUniformDistributionFormula ORDER BY NumberOfPoints";
double[,] arrULD=new int[8];
SqlCeCommand cmd = new SqlCeCommand(sSQL, _conn);
cmd.Connection.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
arrULD[(int)rdr["NumberOfPoints"]] =
{(double)rdr[0],(double)rdr[1]};
}
contain decimal data. Looks like this:
1 .5 .5 0 0 0 0 0 0
2 .25 .25 .25 0 0 0 0 0
etc.
The first column tells me how many points and I will use this as my index in
the array. I want to load this table into an array to be used in some
calculations and i don't want to have to read the database everytime they
change the number of points to calculate. I am new to c# and am having a lot
of trouble declaring my array and populating it. This is what I have so far
but it won't compile because the array is defined wrong..I think??? Please
help.
_conn = new
SqlCeConnection(PocketRigger.LocalStorage.ConnectionString);
string sSQL = "SELECT ULD_Number1, ULD_Number2, ULD_Number3,
ULD_Number4, ULD_Number5, ULD_Number6, ULD_Number7, ULD_Number8,
NumberOfPoints FROM tblUniformDistributionFormula ORDER BY NumberOfPoints";
double[,] arrULD=new int[8];
SqlCeCommand cmd = new SqlCeCommand(sSQL, _conn);
cmd.Connection.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
arrULD[(int)rdr["NumberOfPoints"]] =
{(double)rdr[0],(double)rdr[1]};
}