The error is : " The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect."
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string connectionString, queryString;
connectionString = ConfigurationManager.ConnectionStrings["ostanConnectionString"].ToString();
queryString = "SELECT FROM situation where state ='" + DropDownList1.SelectedValue + "'";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
OleDbCommand command = new OleDbCommand(queryString, connection);
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
DropDownList2.Items.Clear();
while (reader.Read())
DropDownList2.Items.Add(reader["city"].ToString());
reader.Close();
connection.Close();
}
}
}