469,271 Members | 1,235 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

GridView date string to SP to table DateTime col

VS05 : GridView control config'd to use SPs in SS05

One of the SPs takes a vchar(50) which in the T-SQL needs to be converted to
a DateTime.

How should I have the GridView format the text the user enters in the date
col ?

Currently, if user enters "2/14/2006" , I format it as '2/14/2006' ... but
this gives me a runtime error:

Server Error in '/code' Application.
----------------------------------------------------------
The string was not recognized as a valid DateTime. There is a unknown
word starting at index 0.
My table has a primary key defined on an Identity col.

Feb 15 '06 #1
2 2379
DWS
Maybe use date.parse

"John A Grandy" wrote:
VS05 : GridView control config'd to use SPs in SS05

One of the SPs takes a vchar(50) which in the T-SQL needs to be converted to
a DateTime.

How should I have the GridView format the text the user enters in the date
col ?

Currently, if user enters "2/14/2006" , I format it as '2/14/2006' ... but
this gives me a runtime error:

Server Error in '/code' Application.
----------------------------------------------------------
The string was not recognized as a valid DateTime. There is a unknown
word starting at index 0.
My table has a primary key defined on an Identity col.

Feb 15 '06 #2
I think the problem is trying to send it down to SS05 as a DateTime. Better
to send it as a String.

Unless, I've misunderstood SQLDataSource, I believe that you specify .NET
datatypes for your SP params, not SS datatypes.

In other words, write the SP to accept a varchar param, not a datetime param
...... in the SP, use format 'yyyymmdd' and CAST(@datetime1 AS datetime) will
work ..........

Honestly, I'm not sure the VS05 GridView is such a great invention ....
despite all the hype.
"DWS" <DW*@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Maybe use date.parse

"John A Grandy" wrote:
VS05 : GridView control config'd to use SPs in SS05

One of the SPs takes a vchar(50) which in the T-SQL needs to be converted
to
a DateTime.

How should I have the GridView format the text the user enters in the
date
col ?

Currently, if user enters "2/14/2006" , I format it as '2/14/2006' ...
but
this gives me a runtime error:

Server Error in '/code' Application.
----------------------------------------------------------
The string was not recognized as a valid DateTime. There is a unknown
word starting at index 0.
My table has a primary key defined on an Identity col.

Feb 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ken Wigle | last post: by
4 posts views Thread by =?Utf-8?B?QmFidU1hbg==?= | last post: by
1 post views Thread by yogarajan.ganesan | last post: by
4 posts views Thread by =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post: by
3 posts views Thread by COHENMARVIN | last post: by
6 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.