i'm getting vary strenge error ...Column 'RTR_DIVISION' does not belong to table...but the column is

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi...
Im mapping table with data base ...using DataAdepter.FillSchema()
Im printing all the columns name on console...
Then I printing RTR_DIVISION value of each row on the console.
but the problem is when i print<span style="text-decoration:underline column names "RTR_DIVISION" is there .
but when i try to print its value at that momment i get error...
Column RTR_DIVISION does not belong to table
<pre class="prettyprint" style="font-size:11.818181991577148px using (SqlConnection con = new SqlConnection("Data Source=srv;Initial Catalog=test;Persist Security Info=True;User ID=sa;Password=abcd123"))
{
SqlCommand cmd = new SqlCommand("select * from dealer_temp", con);
SqlDataAdapter ad = new SqlDataAdapter(cmd);
ad.FillSchema(dt, SchemaType.Mapped);

foreach(DataColumn dc in dt.Columns)
{
Console.WriteLing(dc.ColumnName);
}

foreach(DataRow dr in dt.Rows)
{

Console.WriteLine(dr["RTR_DIVISION"].ToString());
}
}[/code]
<br/>
<br/>

<br/>

View the full article
 
Back
Top