473,952 Members | 23,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2494
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*@discussion s.microsoft.com > wrote in message
news:96******** *************** ***********@mic rosoft.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
3878
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 using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. Does this approach sound feasible or are there better alternatives? My problem is that I don't...
2
16369
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 DataFormatString is set to "{0:d}" in order to display the date in short date format (without the time). But the DataFormatString doesn't seem to have any effect. The DateTime gets displayed with the time. I have another GridView that is bound...
4
8348
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 date column always shows the date and time while I just want the short date. I have tried applying a format string {0:d} but to no avail. I saw a lot of posts regarding the htmlencode property but I do not know how to turn that off for a...
0
3606
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 OleDbParameterCollection" whenI try to write a new record. Delete and Modify work fine its just the add record function causes the error.
4
7263
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 - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
1
1919
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
8773
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 ‘Update’, the page returns to its original state (prior to clicking Edit) and no updates occur in the DB. What am I missing? I included the html code below. -- Thank-you, Barbara Alderton <body>
3
1580
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 those 3 session variables, and then do a 'gridview.databind' and hope that something happens. But nothing happens - the gridview does not appear. Then I noticed that if I click on a dropdownlist that has 'autopostback' enabled, that the page...
6
1999
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 control and in the gridview_RowDataBound event I have string DiscDescrip = Convert.ToString((e.Row.Cells.FindControl("txbxDiscgv") as TextBox ).Text); This returns what was initially loaded in the textbox but not what I had just changed it...
0
10004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11618
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11219
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11388
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8294
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3569
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.