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
Davood Riazi
NA
474
203.5k
command.ExecuteReader();
Nov 27 2013 4:11 AM
when i use this code in my project in vs 2012 and my Database is Access it display an error in this line " OleDbDataReader reader = command.ExecuteReader();"
The error is : " The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect."
what should i do for solving this error ?
Thanks for any help
Davood
------------------------------
This is my code :
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();
}
}
}
Reply
Answers (
2
)
Partial view with webgrid
where to start iOS apps development?