GridView date string to SP to table DateTime col

J

John A Grandy

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.
 
J

John A Grandy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top