TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
suni dotnet
NA
7
0
string not recognised as valid datetime!!! VERY VERY URGENT
Jan 9 2009 12:20 PM
Hi everyone,
iam trying to convert a gridview cell value (input by user) into datetime.
i tried almost all methods to convert but into vain. working on this from past 3 weeks. plz help...
my code:
string connectionstring = WebConfigurationManager.ConnectionStrings["RoyalHotelManagement"].ConnectionString;
SqlConnection con = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand("InsertSuite", con);
cmd.CommandType = CommandType.StoredProcedure;
string filleddate = GridView2.Rows[e.RowIndex].Cells[2].Text;
string freedate = GridView2.Rows[e.RowIndex].Cells[3].Text;
IFormatProvider theCultureInfo = new System.Globalization.CultureInfo("en-US", true);
DateTime filleddate1 = DateTime.ParseExact(filleddate, "mm/dd/yyyy HH:mm:ss", theCultureInfo);
DateTime freedate1 = DateTime.ParseExact(freedate, "mm/dd/yyyy HH:mm:ss", theCultureInfo);
cmd.Parameters.AddWithValue("@filleddate", filleddate1);
cmd.Parameters.AddWithValue("@freedate", freedate1);
cmd.Parameters.AddWithValue("@nameofcustomer", GridView2.Rows[e.RowIndex].Cells[6].Text);
try
{
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
}
finally
{
con.Close();
}
my storedprocedure:
ALTER PROCEDURE InsertSuite
@filleddate datetime,
@freedate datetime,
@nameofcustomer varchar(50)
AS
BEGIN
SET NOCOUNT ON
Insert into PresidentialSuite(DateWhenFilled,DateWhenFree,NameOfCustomer)
values (@filleddate,@freedate,@nameofcustomer);
END
i tried even with update.... no use
thanks in advance..
Reply
Answers (
7
)
unisgned integers and global cases in C#
Run C# application at Computer startup