c# - Unable to assign DateTime column's value as String -
facing error:
the given value of type string data source cannot converted type
datetime
of specified target column while inserting data database usingsqlbulkcopy
only in 1 server, other server , in development environment working fine.
using (sqlbulkcopy sbc = new sqlbulkcopy(dbsqlconn)) { dbsqlconn.open(); // inserting data table it000 sbc.destinationtablename = strschema + storedprocedurenames.uploadtablegenerichrit000; // number of records processed in 1 go sbc.batchsize = tbluploaddata.rows.count; sbc.columnmappings.add("txtemployeeno", "txtemployeeno"); sbc.columnmappings.add("txtcompany", "txtcompany"); sbc.columnmappings.add("txtemptypecode", "txtemptypecode"); sbc.columnmappings.add("intprocessid", "intprocessid"); sbc.columnmappings.add("txtbatchid", "txtbatchid"); sbc.columnmappings.add("intuploadtype", "intuploadtype"); sbc.columnmappings.add("intsubtypesap", "intsubtypesap"); sbc.columnmappings.add("txtreasonsapcode", "txtreasoncode"); sbc.columnmappings.add("txtreasonsapcode", "txtreasonsapcode"); // sbc.columnmappings.add("txtemployeesubgroup", "txtemployeesubgroup"); sbc.columnmappings.add("dtstartdate", "dtstartdate"); sbc.columnmappings.add("txtcreatedby", "txtcreatedby"); sbc.columnmappings.add("dtcreateddate", "dtcreateddate"); sbc.columnmappings.add("dtlastmodifieddate", "dtlastmodifieddate"); sbc.columnmappings.add("txtlastmodifiedby", "txtlastmodifiedby"); sbc.columnmappings.add("flginfotypeevent", "flginfotypeevent"); sbc.columnmappings.add("txtreferencekey", "txtreferencekey"); sbc.columnmappings.add("flgstatus", "flgstatus"); sbc.columnmappings.add("txtremarks", "txtremarks"); sbc.columnmappings.add("flgmodified", "flgmodified"); sbc.writetoserver(tbluploaddata); intres = 1; sbc.close(); dbsqlconn.close(); }
Comments
Post a Comment