Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old August 8th, 2004, 01:37 AM
Shams Al Shams Al is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 25 Shams Al User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
simple problem perhaps to u guys

ok i have a MSSQL database using a datagrid to show
date in a column of the datagrid.
i need to be able to edit that column and save it to the database
in the MSSQL database the column is of type "smalldatetime"
i enter the date in the formats:
mm/dd/yyyy or m/d/yyyy how do i convert the text from the
textbox to date or datetime? or is there anything called smalldatetime?
thanx
shams

Reply With Quote
  #2  
Old August 8th, 2004, 08:56 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,751 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 3 h 32 m 46 sec
Reputation Power: 443
You shouldn't need to convert it to pass it to the database.
But to convert a string to a date just use the CDate() function.

Reply With Quote
  #3  
Old August 8th, 2004, 07:03 PM
Shams Al Shams Al is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 25 Shams Al User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dim strjotitle, strjostatus, strjocutoffdate AsString
'Dim Djocutoffdate As Date
Dim DS AsNew DataSet()
strjocutoffdate = CType(e.Item.FindControl("txtjocutoff"), TextBox).Text
strjotitle = CType(e.Item.FindControl("txtjotitle"), TextBox).Text
strjostatus = CType(e.Item.FindControl("SddljostatusA"), DropDownList).SelectedItem.Value
'Djocutoffdate = CDate(strjocutoffdate)
'Add values to the update parameters if present
'The job id is located in the 1st column (index 0)
DAjobposted.UpdateCommand.Parameters.Item("@jid").Value = e.Item.Cells(0).Text
If strjocutoffdate <> "" Then DAjobposted.UpdateCommand.Parameters.Item("@jocutoff").Value = strjocutoffdate
If strjotitle <> "" Then DAjobposted.UpdateCommand.Parameters.Item("@jotitle").Value = strjotitle
If strjostatus <> "" Then DAjobposted.UpdateCommand.Parameters.Item("@jostatus").Value = strjostatus

thank you very much for the reply memnoch

above is the code i used.....
i get the following error: Update failed - Procedure 'updatejobposted' expects parameter '@jotitle', which was not supplied.

in my sql database: @jocutoff is in smalldatetime and can be null, @jotitle is varchar(100) not null, @jostatus is varchar 10
following is my sql stored procedure:

ALTER PROCEDURE updatejobposted
(
@jid integer,
@jocutoff smalldatetime=null,
@jotitle varchar(100),
@jostatus char(1)
)
AS
UPDATE Jobs SET jocutoff=@jocutoff, jotitle=@jotitle, jostatus=@jostatus
WHERE jid=@jid

how can i solve this please help someone
Shams

Reply With Quote
  #4  
Old August 10th, 2004, 01:53 PM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Hi,

The error message you get does not corresponds to the question you ask. It seems that somewhere there has slipped an error with the @jotitle parameter. The error message that was thrown at you, simply says that it expects an parameter @jotitle to be present and filled with something, but it couldn't find it.

Debug the update statement and see what is wrong there. There is nothing wrong with the date field or parameter.

Grtz.©

M.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > simple problem perhaps to u guys


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway