Conversion from vb.net String to DB2 Timestamp -
i'm frustated right now, because can't manage vb.net manually created date datatype db2 column has timestamp datatype.
i tried few different ways handle this, no matter error "sql0180n: syntax of string representation of datetime value incorrect".
the part in application handles conversion string date right here:
dim neuesdatum date neuesdatum = cdate(jahr & "-" & "0" & monat & "-01 00:00:00")
the string conversion looks this: 2013-01-01 00:00:00
i tried high german format of date (01.01.203), tried utilize string without lastly part (00:00:00), no matter ends same way.
i utilize stored procedure insert info table. date delivered parameter "sollmonat".
create or replace procedure "addon21c"."stp_beitragssatz_add" ( in @id bigint, in @typ varchar(100), **in @sollmonat timestamp,** in @g varchar(100), in @f varchar(100), in @h varchar(100), in @u1 varchar(100), in @u2 varchar(100), in @u1erhoeht varchar(100), in @u1ermaessigt varchar(100), in @rv varchar(100), in @alv varchar(100), in @p varchar(100), in @rvgf varchar(100), in @kvgf varchar(100), in @zusatzkv varchar(100), in @zusatzpv varchar(100), in @inso varchar(100), out @result bigint ) language sql specific sql12080109131643 begin if @id null or @id = 0 insert "addon21c".bs (typ, sollmonat, g, f, h, u1, u2, u1erhoeht, u1ermaessigt) values (@typ, @sollmonat, @g, @f, @h, @u1, @u2, @u1erhoeht, @u1ermaessigt); set @result = identity_val_local(); end if; end
the datatype "sollmonat" within of datatable timestamp, too.
guys, happy if can help me out here. i'm out of ideas , no, can't save date varchar in table. saving date in database might possible, believe i'd have same problem there.
thanks in advance!
@steve create whole thing more confusing, because build myself few classes allow me map classes datatables, assured isn't screws up. when utilize not manually created date, date.now example, works fine.
there couple of ways might seek this. 1 saying parameter timestamp, , pass in date
type:
cmddb2.parameters.add("@sollmonat", db2type.timestamp).value = neuesdatum
another possibility defining right string representation of date, , using .tostring()
. below couple format strings, utilize 1 match database's info type.
private const db2_tstamp = "yyyy-mm-dd-hh.mm.ss.ffffff" private const db2_date = "mm/dd/yyyy" cmddb2.parameters.add("@sollmonat", neuesdatum.tostring(db2_tstamp))
these options have worked me in past. timestamp format string should work time (it odbc standard timestamp), date format string may vary location, have @ this article in info center.
vb.net db2
No comments:
Post a Comment