![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi guys, I've created a simple webpage with a datagridview, my business object. If i try to modify a record i get an error on date value: Dettagli eccezione: System.InvalidOperationException: Impossible to convert the value of parameter 'DataNascita' from 'System.String' to 'System.DateTime'. What should I do? Thanks |
#3
| |||
| |||
|
|
redbull wrote: Hi guys, I've created a simple webpage with a datagridview, my business object. If i try to modify a record i get an error on date value: Dettagli eccezione: System.InvalidOperationException: Impossible to convert the value of parameter 'DataNascita' from 'System.String' to 'System.DateTime'. What should I do? Thanks You can't populate a DateTime value field or variable with string data representing a date and time. The string date and time must be converted over to System.Datetime before the field or variable can be populated by string data the represents a date and time. You should look up how to use the 'Convert' statement. |
#4
| |||
| |||
|
|
"Mr. Arnold" <Arnold (AT) Arnold (DOT) com> ha scritto nel messaggio news:Ox8s0kdGLHA.5700 (AT) TK2MSFTNGP04 (DOT) phx.gbl... redbull wrote: Hi guys, I've created a simple webpage with a datagridview, my business object. If i try to modify a record i get an error on date value: Dettagli eccezione: System.InvalidOperationException: Impossible to convert the value of parameter 'DataNascita' from 'System.String' to 'System.DateTime'. What should I do? Thanks You can't populate a DateTime value field or variable with string data representing a date and time. The string date and time must be converted over to System.Datetime before the field or variable can be populated by string data the represents a date and time. You should look up how to use the 'Convert' statement. to insert the value i do: persona.data= Convert.ToDateTime(Me.TextBox3.Text) The problem raises when i click on update dategridview.....but how can I modify code related to selcet/update/insert in datagridview? Thanks |
#5
| |||
| |||
|
|
What is 'DataNascita', because that's what it doesn't like? |
#6
| |||
| |||
|
| "Mr. Arnold" <Arnold (AT) Arnold (DOT) com> ha scritto nel messaggio news:#8mdTghGLHA.5668 (AT) TK2MSFTNGP04 (DOT) phx.gbl... What is 'DataNascita', because that's what it doesn't like? db sqlserver 2008, datanascita means "birth date" and it is a date type on the db on the business object I have defined the property DataNascita like a datetime The problem is got when i call update function on datagridview.... |
#7
| |||
| |||
|
|
Well, you're going to need to come up with something else, because apparently that variable type cannot be cast to a string by the gridview, unless you step in with a function that does so. |
#8
| |||
| |||
|
| "Mr. Arnold" <Arnold (AT) Arnold (DOT) com> ha scritto nel messaggio news:eXymfC$GLHA.552 (AT) TK2MSFTNGP06 (DOT) phx.gbl... Well, you're going to need to come up with something else, because apparently that variable type cannot be cast to a string by the gridview, unless you step in with a function that does so. How can I do it? Give m some help please. I don't know what I must do |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |