TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
saifullah khan
NA
335
300.9k
Invalid column name ''.
Jun 4 2011 1:50 AM
i have 3 database tables.
1. town(townname)
2.phase(phasename,townname)
3.sector(sectorname,townnam,phasename)
the datatype of all these fields is nvchar(50).
i have one webform sectorname.aspx
it consists:
townname.dropdown
phasename.dropdown
sectorname.textbox
townname.dropdown takes data frm town table in the database.
when i click on on townname.dropdown and select an item. it takes all those phase name in phase table that come under that selected town. but when i select townname it gives me the following error.
Invalid column name 'hayatabad'.
the code the given here.
protected void TownID_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataSet ds = new DataSet();
SqlDataAdapter adap = new SqlDataAdapter();
cmd = new SqlCommand("select * from Phase where TownName=" + TownName.SelectedValue.ToString(), con);
//cmd.Connection = con;
con.Open();
adap.SelectCommand = cmd;
adap.Fill(ds);
dt = ds.Tables[0];
PhasName.DataSource = dt;
PhasName.DataTextField = "PhaseName";
PhasName.DataValueField = "PhaseName";
PhasName.DataBind();
}
please tell me whats the problem.???
Reply
Answers (
6
)
Listview/Datapager inside AJAX Accordion with custom data source
Getting Assemly related error