Prolem in inserting new Row-DB2 Date Time
-
hi I got a problem in inserting new rows to a datatable.How can I insert dates in a data table using DB2. Here is some code... DB2Connection conn = new DB2Connection(connectionString); DB2DataAdapter DataAd= new DB2DataAdapter(select, conn); DataSet ds=new DataSet(); DataAd.Fill(ds, "Table Name"); Datarow dr = ds.Tables["Table Name"].NewRow(); DB2Command aCommand = new DB2Command(select, conn); aCommand.CommandType = CommandType.Text; aCommand = new DB2Command("INSERT INTO CL.VSCHTM("ST_DTE")" "VALUES ("#" + dr["ST_DTE"]+"#",conn); DataAd.InsertCommand = aCommand; DataAd.Update(ds, "Table Name"); aCommand.Parameters.Add(new DB2Parameter("ST_DTE",DB2Type.Date, 0, "ST_DTE")); aCommand.UpdatedRowSource = UpdateRowSource.OutputParameters; It doesn't add new row ,any help?? kidus
-
hi I got a problem in inserting new rows to a datatable.How can I insert dates in a data table using DB2. Here is some code... DB2Connection conn = new DB2Connection(connectionString); DB2DataAdapter DataAd= new DB2DataAdapter(select, conn); DataSet ds=new DataSet(); DataAd.Fill(ds, "Table Name"); Datarow dr = ds.Tables["Table Name"].NewRow(); DB2Command aCommand = new DB2Command(select, conn); aCommand.CommandType = CommandType.Text; aCommand = new DB2Command("INSERT INTO CL.VSCHTM("ST_DTE")" "VALUES ("#" + dr["ST_DTE"]+"#",conn); DataAd.InsertCommand = aCommand; DataAd.Update(ds, "Table Name"); aCommand.Parameters.Add(new DB2Parameter("ST_DTE",DB2Type.Date, 0, "ST_DTE")); aCommand.UpdatedRowSource = UpdateRowSource.OutputParameters; It doesn't add new row ,any help?? kidus
Is the datetime the min value in .net? There is a chance that db2 doesn't support it. I know sql server does not. I would think if the row doesn't get inserted there must be an error message. Have you tried to do the insert outside of .net to see if it works? Ben