title: The conversion of a varchar data type to a datetime data type throws an out-of-range exception..?
body: <p>i have taken all date value as date in database but when i give valye 09/11/2014..its accepting but when i give value in -30/10/2014..its giving this kind of error..why..need help... </p>
  
  <pre><code>Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      'TODO:add data into data base
      If ComboBox1.Text &lt;&gt; "" Then
          Dim ab As Long
          ab = random.Next("10000", "99999")
  
  
          Dim date1 As Date = Date.ParseExact(TextBox3.Text, "dd/MM/yyyy", Nothing).Date
          Dim date2 As Date = Date.ParseExact(TextBox4.Text, "dd/MM/yyyy", Nothing).Date
          Dim date3 As Date = Date.ParseExact(TextBox5.Text, "dd/MM/yyyy", Nothing).Date
          'Dim date3 As Date = Date.Parse(TextBox5.Text)
          Dim date4 As Date = Date.ParseExact(TextBox6.Text, "dd/MM/yyyy", Nothing).Date
  
          If Button1.Enabled = False Then
              If TextBox11.Text &lt;&gt; "" And ComboBox1.Text &lt;&gt; "" And TextBox2.Text &lt;&gt; "" And TextBox3.Text &lt;&gt; "" And TextBox4.Text &lt;&gt; "" Then
                  TextBox10.Text = ab
                  cm.Close()
                  cm.Open()
                  ComboBox1.Text = Replace(ComboBox1.Text, "'", "''")
                  TextBox1.Text = Replace(TextBox1.Text, "'", "''")
                  TextBox7.Text = Replace(TextBox7.Text, "'", "''")
                  TextBox6.Text = Now.Date.ToString("dd/MM/yyyy")
                  TextBox8.Text = DateTime.Now.ToString("HH:mm:ss")
                  cmd.CommandText = "insert into worker(faccno,fname,faddr,famcdue,fjoindate,fdate,fattended,fproblem,fsolution,fstatus,fremark,fassign,findate,fintime,fserviceno,falert)values ('" &amp; TextBox11.Text &amp; "', '" &amp; ComboBox1.Text &amp; "','" &amp; TextBox2.Text &amp; "','" &amp; date1.ToString("dd/MM/yyyy") &amp; "','" &amp; date2.ToString("dd/MM/yyyy") &amp; "','" &amp; date3.ToString("dd/MM/yyyy") &amp; "','" &amp; ComboBox4.Text &amp; "','" &amp; TextBox1.Text &amp; "','" &amp; TextBox7.Text &amp; "','" &amp; ComboBox2.Text &amp; "','" &amp; ComboBox6.Text &amp; "','" &amp; ComboBox5.Text &amp; "','" &amp; date4 &amp; "','" &amp; TextBox8.Text &amp; "','" &amp; TextBox10.Text &amp; "','" &amp; ComboBox3.SelectedIndex &amp; "')"
                  cmd.ExecuteNonQuery()
                  MessageBox.Show("Information Insertion sucessfull", "Save")
                  MessageBox.Show(ab, "your service no is")
                  Button7.PerformClick()
                  cm.Close()
              Else
                  MessageBox.Show("enter all values then try to save information", "error")
                  Exit Sub
              End If
          ElseIf ComboBox1.Text &lt;&gt; "" Then
              cm.Close()
              cm.Open()
              TextBox1.Text = Replace(TextBox1.Text, "'", "''")
              TextBox7.Text = Replace(TextBox7.Text, "'", "''")
              TextBox6.Text = Now.Date.ToString("dd/MM/yyyy")
              TextBox8.Text = DateTime.Now.ToString("HH:mm:ss")
              ComboBox4.Text = Replace(ComboBox4.Text, "'", "''") 'TODO:this code replaces single quotes to store in data base
              cmd.CommandText = "update worker set faccno= '" &amp; TextBox11.Text &amp; "', fname='" &amp; ComboBox1.Text &amp; "',faddr='" &amp; TextBox2.Text &amp; "',famcdue='" &amp; date1 &amp; "',fjoindate='" &amp; date2 &amp; "',fdate='" &amp; date3 &amp; "',fattended='" &amp; ComboBox4.Text &amp; "',fproblem='" &amp; TextBox1.Text &amp; "',fsolution=  '" &amp; TextBox7.Text &amp; "',fstatus='" &amp; ComboBox2.Text &amp; "',fremark='" &amp; ComboBox6.Text &amp; "',fassign= '" &amp; ComboBox5.Text &amp; "',findate='" &amp; date4 &amp; "',fintime='" &amp; TextBox8.Text &amp; "',fserviceno='" &amp; TextBox10.Text &amp; "',falert='" &amp; ComboBox3.SelectedIndex &amp; "' where fserviceno='" &amp; TextBox10.Text &amp; "'"
              cmd.ExecuteNonQuery()
              MessageBox.Show(" Information Updation sucessfull", "Save")
              Button7.PerformClick()
              cm.Close()
          End If
      Else
          MessageBox.Show("enter all values then try to save information", "error")
          Exit Sub
      End If
  
  End Sub
  </code></pre>