Howdy, Stranger!

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


Get value from field

marcobranco75marcobranco75 Member Posts: 1
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;
cmd.CommandText = sql;
SqlDataReader dr;
dr = cmd.ExecuteReader();[/code]

Thank's in advance


  • mnagaria2011mnagaria2011 Member Posts: 2

    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.