Reputation: 1784
I have this code in VB6
Dim datahorS As String
datahorS = Text21.text & " " & Text22.text
Label2.Caption = datahorS
SQL = " insert into TabNFe_x ( data_hora_ent) values " _
& "(" & "'" & datahorS & "'" & ")"
datahorS = 20/10/2016 13:54 and the command
insert into TabNFe_x ( data_hora_ent) values ('20/10/2016 13:54')
erro from SQL
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
what's i m making wrong.
Upvotes: 0
Views: 224
Reputation: 81930
Convert your string into a datetime
Select convert(datetime, '20/10/2016 13:54', 103)
Returns
2016-10-20 13:54:00.000
Upvotes: 1