G
Guest
I get this strange error:
Column 'PNR ' does not belong to table Table
It is strange because the columnname in the dataset is PNR.
String SQL = "SELECT PERSONNR AS PNR, ... FROM theTABLE";
OleDataAdapter.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
String t1 = dr[0].ToString(); //gives correct value
String t2 = ds.Tables[0].Columns[0].ColumnName; // gives "PNR"
String t3 = dr["PNR"].ToString(); //Gives error, why?
}
I've tried to rename the column and even selected without alias. Same error.
Column 'PNR ' does not belong to table Table
It is strange because the columnname in the dataset is PNR.
String SQL = "SELECT PERSONNR AS PNR, ... FROM theTABLE";
OleDataAdapter.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
String t1 = dr[0].ToString(); //gives correct value
String t2 = ds.Tables[0].Columns[0].ColumnName; // gives "PNR"
String t3 = dr["PNR"].ToString(); //Gives error, why?
}
I've tried to rename the column and even selected without alias. Same error.