| | |
String was not recognized as a valid DateTime.
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 7
Reputation:
Solved Threads: 0
hi i am using asp.net with c# i get this problem when i try to enter date grater than 12 "String was not recognized as a valid DateTime."
i am using sql server 2005. In the table field is in datetime format.In the procedure its is also taking as datetime.and the codes are
DateTime dob = Convert.ToDateTime(txtdob.Text.ToString().Trim());
rec.Add("dob", dob); rec is a hash table.
and the regional setting short date time :MM/dd/yyyy
please help
i am using sql server 2005. In the table field is in datetime format.In the procedure its is also taking as datetime.and the codes are
DateTime dob = Convert.ToDateTime(txtdob.Text.ToString().Trim());
rec.Add("dob", dob); rec is a hash table.
and the regional setting short date time :MM/dd/yyyy
please help
•
•
Join Date: Nov 2008
Posts: 7
Reputation:
Solved Threads: 0
sir i am using this code in the submit event
not in page load.
protected void btnSave_Click(object sender, System.EventArgs e)
{
try
{
Hashtable rec = new Hashtable();
if (txtdob.Text.Length != 0)
{
DateTime dob = Convert.ToDateTime(txtdob.Text.Trim());
rec.Add("dob", dob.ToShortDateString());
}
}
catch( Exception ex)
{
lblerror.visible=true;
lbl.text=ex.Message;
}
}
}
not in page load.
protected void btnSave_Click(object sender, System.EventArgs e)
{
try
{
Hashtable rec = new Hashtable();
if (txtdob.Text.Length != 0)
{
DateTime dob = Convert.ToDateTime(txtdob.Text.Trim());
rec.Add("dob", dob.ToShortDateString());
}
}
catch( Exception ex)
{
lblerror.visible=true;
lbl.text=ex.Message;
}
}
}
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Log in Page ASP.NET (C#)
- Next Thread: Checking Number in a String and calculate..
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax alltypeofvideos appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit editing embeddingactivexcontrol feedback fileuploader fill findcontrol flash folder form gridview gudi iis image javascript list listbox login maps microsoft mobile mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols parent problem project radio redirect registration relationaldatabases reportemail richtextbox rows schoolproject search security select sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview validatedate validation vb.net videos vista visualstudio vs2008 web webapplications webdevelopment webprogramming webservice wizard xsl





