Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6738305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:21:05+00:00 2026-05-26T11:21:05+00:00

I have two tables called visits and members and i am getting the data

  • 0

I have two tables called visits and members and i am getting the data by using following query..

 string sql=  @"SELECT member_Firstname, member_Lastname, member_Postcode,  
          visit_DateTime, visit_Status, visit_Logout_DateTime, visits.member_Id, visit_AlertMsg
          FROM members, visits
          WHERE members.member_Id = visits.member_Id
          AND members.member_Active LIKE 'y%'";

at here i am getting the visit_DateTime values with by using some comparisons with combobox values

    datatable dt = helper.getdata(sql)
     foreach (DataRow row in dt.Rows)
     {
         if (row["visit_Logout_DateTime"] != null)
         {
          DateTime dtlogout = DateTime.Parse(row["visit_Logout_DateTime"].ToString());
          if (dtlogout != null)
          {
            if (cbPeriod.Text == "Today")
            {
              newItem.lblTime.Text = dtlogout.ToString("HH':'mm':'ss");

            }
            else
              newItem.lblTime.Text = dtlogout.ToString("yyyy'-'MM'-'dd'  -  'HH':'mm':'ss");
          }
        }

     }

but i got the error at this line DateTime dtlogout = DateTime.Parse(row["visit_Logout_DateTime"].ToString());

error : string was not recognised as valid datetime (because of one value in that row is empty)

the row "visit_Logout_DateTime"

i have got the values of "visit_Logout_DateTime" like this….

firstname     lastname   postcode      visit_Logout_DateTime
-------------  --------   ---------      ---------------------
 rob            peter     hhd344h            
 peter         chan        hy78kjk         2011-09-08 12:09:08
 rock          sam        yudufg3746h      2011-08-08 09:08:45

i have tried that for checking the empty values of this visit_Logout_DateTime like i mentioned above..

but i have failed for chacking ever value is empty or not in that row…

how to check every value in this row (row[“visit_Logout_DateTime”]) is empty or not

would any one pls help me on this guys …

many thanks….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:21:06+00:00Added an answer on May 26, 2026 at 11:21 am

    Instead of checking if the column is null, you should check if the contents of the column are null. You can do that by comparing it to DBNull.Value:

    if (row["visit_Logout_DateTime"] != DBNull.Value)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables. One of them called conversations has the following data. ConversationID
I have two tables called TableA and TableB. TableA has the following fields: TableA_ID
I have two tables called ASI and Call and the data in the tables
I have two sql tables called scan_sc and rescan_rsc . The scan table looks
I have two tables: members and renewals The two tables have a field called
Say I have two tables called A (fields: id, phase, name) and B(fields: id,
I have two tables in my database, called ratings and movies . Ratings: |
I have two tables, one called cart and one called items. Now I want
So i'm having this problem. I have two tables (Oracle), one is called Destination
I am using MYSQL and PHP. I have a table called item. Two of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.