G
Guest
This worked in the command window while in debug mode
?table.Rows[0].ItemArray["ColumnName"].ToString()
"f0165f94-648f-4997-b578-11d89c8b1f61"
But gives the error below when I compile.
Cannot implicitly convert type 'string' to 'int' and the word ColumnName is
underlined.
Here is a code snippett (with error line marked with an asterisk):
DataSet ds = new DataSet();
ds.ReadXml(@"D:\Data\test.xml", XmlReadMode.ReadSchema);
foreach (DataTable table in ds.Tables)
{
for (int index = 0; index <= table.Rows.Count; index++)
{
{
SqlCommand command = new SqlCommand("ImportData", conn);
command.CommandType = CommandType.StoredProcedure;
adapter.InsertCommand = command;
SqlParameter param;
param = command.Parameters.Add("@columnID", SqlDbType.UniqueIdentifier);
* param.Value = new
Guid(table.Rows[index].ItemArray["ColumnName"].ToString());
}
}
}
Did I do something wrong that I am not seeing, or is there another way to
reference a column?
?table.Rows[0].ItemArray["ColumnName"].ToString()
"f0165f94-648f-4997-b578-11d89c8b1f61"
But gives the error below when I compile.
Cannot implicitly convert type 'string' to 'int' and the word ColumnName is
underlined.
Here is a code snippett (with error line marked with an asterisk):
DataSet ds = new DataSet();
ds.ReadXml(@"D:\Data\test.xml", XmlReadMode.ReadSchema);
foreach (DataTable table in ds.Tables)
{
for (int index = 0; index <= table.Rows.Count; index++)
{
{
SqlCommand command = new SqlCommand("ImportData", conn);
command.CommandType = CommandType.StoredProcedure;
adapter.InsertCommand = command;
SqlParameter param;
param = command.Parameters.Add("@columnID", SqlDbType.UniqueIdentifier);
* param.Value = new
Guid(table.Rows[index].ItemArray["ColumnName"].ToString());
}
}
}
Did I do something wrong that I am not seeing, or is there another way to
reference a column?