Solved

Find null dates in database

Posted on 2011-03-07
8
191 Views
Last Modified: 2012-08-13
Here is a sample of my Db                                                                                  Database sample
Ok, here is what Im trying to do.  

•      Select Date on Monthly Calendar

•      Fill text box with selected date

•      Fill Data table adapter with data from selected date (4 row)

•      Make green button visible if valid date in row is (not null, date is same as selected
Date (time is diff) else not visible.

•      Display selected date (no edit)

•      Display the Data table adapters data from selected date (4 rows) with Show-Up-Down  for time of day

I need to have the button change color if there is a null in the selected row.

Here is some of my code.

Public Sub MCal_MachSch_DateSelected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MCal_MachSch.DateSelected
        
TxtBxSelectDate.Text = e.Start.ToShortDateString()
 
   End Sub

Private Sub BntSelectDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BntSelectDate.Click
        Refresh()
        
Try
           
            Me.Shift1TableAdapter.Fill(Me.RPDDataSet.Shift1, Me.TxtBxSelectDate.Text)
 
            If (Me.RPDDataSet.Shift1.B2_1st_StartColumn.ToString) IsNot DBNull.Value Then
                Me.Bnt_B2_1st.Visible = True
            Else : Me.Bnt_B2_1st.Visible = False
            End If
     End Sub

Open in new window

app sample
0
Comment
Question by:Jpcoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35062827
Change line 14 to:

    If Me.RPDDataSet.Shift1.B2_1st_StartColumn IsNot DBNull.Value Then
0
 

Author Comment

by:Jpcoder
ID: 35069567
I changed line 14,
but  Me.Bnt_B2_1st.Visible = True  stays True even when the value is null.
Is that a problem in the table adapter?
0
 
LVL 7

Expert Comment

by:foobarr
ID: 35112151
When you debug

What does Me.RPDDataSet.Shift1.B2_1st_StartColumn.ToString() return when it reaches a null date?

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Jpcoder
ID: 35133595
It returns {  } empty.

0
 
LVL 7

Accepted Solution

by:
foobarr earned 500 total points
ID: 35157208
If String.IsNothing(Me.RPDDataSet.Shift1.B2_1st_StartColumn.ToString) = False Then
                Me.Bnt_B2_1st.Visible = True
            Else : Me.Bnt_B2_1st.Visible = False
            End If


basically instead of checking if the DBNULL, check to see if the string is nothing
0
 

Author Comment

by:Jpcoder
ID: 35169454
Ok that makes sense. I will give that a try on Monday (after the NCAA games) and let you know.
thanks
0
 

Author Comment

by:Jpcoder
ID: 35379956

Ok , when I ran this it gave me the column header instead of the date in the cell
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question