G
Givisiez
Hi
I'm programming a windows application. I store values on a SQL-
database.
Now I've a problem reading the values stored.
I want to read a whole column from a table. I tried my SQL Command in
the "Query" from the Microsoft Visual Studio. There I get exactly the
values, which I want.
When I use the same command with a ExecuteReader, the only value which
I get for "reader" is:
System.Data.SqlClient.SqlDataReader
But I expect a table of values with float values. Does anybody has an
Idea where I made a mistake?
SqlDataReader reader;
try
{
SQLComm.CommandText = "SELECT r.valeur FROM
Resultats_mesure_testeur ...
SQLComm.Connection = conn;
conn.Open();
reader = SQLComm.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
test = reader.GetFloat(1);
}
In test I expect a value like "10" or something like that. But when I
debug I got an Error, Indexoutofboundexception.
Thanks for any help in advance!
Cheers,
Marco
I'm programming a windows application. I store values on a SQL-
database.
Now I've a problem reading the values stored.
I want to read a whole column from a table. I tried my SQL Command in
the "Query" from the Microsoft Visual Studio. There I get exactly the
values, which I want.
When I use the same command with a ExecuteReader, the only value which
I get for "reader" is:
System.Data.SqlClient.SqlDataReader
But I expect a table of values with float values. Does anybody has an
Idea where I made a mistake?
SqlDataReader reader;
try
{
SQLComm.CommandText = "SELECT r.valeur FROM
Resultats_mesure_testeur ...
SQLComm.Connection = conn;
conn.Open();
reader = SQLComm.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
test = reader.GetFloat(1);
}
In test I expect a value like "10" or something like that. But when I
debug I got an Error, Indexoutofboundexception.
Thanks for any help in advance!
Cheers,
Marco