|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > simple problem perhaps to u guys |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|