Get value from field

Hi i need to get the value of a field:

How could i get the value of the field request (the field type is boolean

Thank's in advance

Here is the code:
[code]string sql = "SELECT request FROM Table1 where id = 10";
string connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = sql;
SqlDataReader dr;
dr = cmd.ExecuteReader();[/code]

Thank's in advance

Comments

  • Hi,

    I believe you can do something like below. The syntax might not be correct but you will get an idea.

    while (reader.Read())
    {
    if(reader.GetValue(0) != DBNull.Value)
    {
    bool result = reader.GetValue(0)
    }

    }

    Hope this helps
    ASP.NET Hosting
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion