Hi,
i have a Dataset (dataSet) and two tables there:
table "I_ABC" and "RESULT"
The table RESULT has two columns: ID and STH
The table RESULT is my output table and i will load
the column of I_ABC in my table RESULT:
I_ABC.ID > RESULT.ID
This is my code:
foreach(DataRow dr in dataSet.I_ABC)
{
DataRow newRow;
newRow = result.NewRow();
newRow[0] = dataSet.I_CUS.Columns["ID"];
//newRow["Bestand"] = "bestand";
ergebnis.Rows.Add(newRow);
}
myDataView = new DataView(result);
dataGrid1.DataSource = myDataView;
The values of I_ABC are from an oracle table.
There is the datatype of "ID": numeric.
In my DataSet (I've dropped the table from the dataconnection to my dataSet) is the datatype: decimal.
I create columns of the table RESULT as:
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.Int32"
myDataColumn.ColumnName = "ID";
myDataColumn.AllowDBNull = true;
myDataColumn.Unique = true;
result.Columns.Add(myDataColumn);
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.In32"
myDataColumn.ColumnName = "Bestand";
myDataColumn.AllowDBNull = true;
result.Columns.Add(myDataColumn);
I get this error message:
An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: System.InvalidCastException: Specified cast is not valid.
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <ID> in ID Column. Expected type is Int32.
What's wrong? What can I do?
Thanks,
Stephanie
i have a Dataset (dataSet) and two tables there:
table "I_ABC" and "RESULT"
The table RESULT has two columns: ID and STH
The table RESULT is my output table and i will load
the column of I_ABC in my table RESULT:
I_ABC.ID > RESULT.ID
This is my code:
foreach(DataRow dr in dataSet.I_ABC)
{
DataRow newRow;
newRow = result.NewRow();
newRow[0] = dataSet.I_CUS.Columns["ID"];
//newRow["Bestand"] = "bestand";
ergebnis.Rows.Add(newRow);
}
myDataView = new DataView(result);
dataGrid1.DataSource = myDataView;
The values of I_ABC are from an oracle table.
There is the datatype of "ID": numeric.
In my DataSet (I've dropped the table from the dataconnection to my dataSet) is the datatype: decimal.
I create columns of the table RESULT as:
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.Int32"
myDataColumn.ColumnName = "ID";
myDataColumn.AllowDBNull = true;
myDataColumn.Unique = true;
result.Columns.Add(myDataColumn);
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.In32"
myDataColumn.ColumnName = "Bestand";
myDataColumn.AllowDBNull = true;
result.Columns.Add(myDataColumn);
I get this error message:
An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: System.InvalidCastException: Specified cast is not valid.
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <ID> in ID Column. Expected type is Int32.
What's wrong? What can I do?
Thanks,
Stephanie