Hi,
I'm working with Mobile Tracking System. Wherein I have assignedDate and expirationDate in my database. What I want to do is do detect wether the assigned phone is going to expire.

You can do it like this:

Dim dateOfExpiration As DateTime = DateTime.MinValue
Dim sqlConn As SqlConnection = New SqlConnection("connString")
Dim cmd As SqlCommand = New SqlCommand
cmd.CommandText = "SELECT expirationDate FROM MyTable WHERE PhoneName = @name"
cmd.Parameters.Add("@name", SqlDbType.VarChar, 50).Value = "yourPhoneName"
cmd.Connection = sqlConn
sqlConn.Open
Dim reader As SqlDataReader = cmd.ExecuteReader
If read.Read Then
    dateOfExpiration = CType(reader(0),DateTime)
End If
reader.Dispose
cmd.Dispose
sqlConn.Dispose
If (dateOfExpiration.Date > DateTime.Now.Date) Then
    MessageBox.Show("This telephone has expired.")
End If

Hope it helps,
bye

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.