473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 2473
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
2
by: Rob Roberts | last post by:
I have a GridView that is bound to a collection of DateTimes (i.e. - Collection<DateTime>). I have a BoundField in the GridView, and its DataField is set to the DateTime's Date property, and the...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
1
by: yogarajan.ganesan | last post by:
hello friend am new in asp.net i have one doubt pls help me page load: DataSet ds = BuildDataSet(); DataGrid1.DataSource = ds; DataGrid1.DataBind();
4
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I setup a simple gridview as a utility just to do some updates, nothing fancy just wanted easy UI to make updates. When I select ‘Edit’, I get the fields I want to edit. I edit them and click...
3
by: COHENMARVIN | last post by:
I have a sqldatasource control that uses 3 parameters. I have a gridview that depends on the sqldatasource control The 3 parameters are session variables. So in my code, I set the values of...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.