title: Convert text into date format in Visual Studio 2013 using C# and save it in SQL Server 2014
body: <p>I want to convert text into date format in Visual Studio 2013 by using C#. Alas! I am getting difficulties in it. I also want to save this data in SQL Server 2014.</p>
  
  <p>My code is</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
          {
              con.Open();
              SqlCommand cmd = con.CreateCommand();
              cmd.CommandType = CommandType.Text;
              cmd.CommandText= "insert into Optical values('"+date.Text+"','"+name.Text+"','"+guardian.Text+"','"+gender.Text+"','"+age.Text+"','"+address.Text+"','"+occupation.Text+"','"+telephone.Text
                  +"','"+sph.Text+"','"+cyl.Text+"','"+axis.Text+"','"+prism.Text+"','"+lsph.Text+"','"+lcyl.Text+"','"+laxis.Text+"','"+lprism.Text+"','"+note.Text+"')";
              cmd.ExecuteNonQuery();
  
              con.Close();
          }
  </code></pre>
  
  <p>I want to change just date's text into date format. Please anybody guide me, how can I do it?</p>