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
znaneswar kodavanti
NA
21
36.7k
problem while inserting to access database
Jul 13 2012 7:40 AM
am getting problem while inserting the below query to access database from c# its showing exception as syntax error at insert to statement please help me
thanks in advance..
string date = dateTimePicker1.Value.ToString("MM/dd/yyyy");
int from=Convert.ToInt32(com_from.SelectedValue.ToString());
int to=Convert.ToInt32(com_to.SelectedValue.ToString());
//string partyname=(((DataRowView)com_class.SelectedItem)["class_name"]).ToString();
int partyname = Convert.ToInt32(com_party.SelectedValue.ToString());
int carno = Convert.ToInt32(com_carnum.SelectedValue.ToString());
int advance = Convert.ToInt32(txt_advance.Text);
int total = Convert.ToInt32(txt_gndtot.Text);
int closingkm=Convert.ToInt32(txt_closingkm.Text);
int startingkm = Convert.ToInt32(txt_startingkm.Text);
string query = "insert into bill(billdate,from,to,partyname,carnumber,closingkm,startingkm,total,advance) values(" + date.ToString() + "," + from + "," + to + "," + partyname + "," + carno + "," + closingkm + "," + startingkm + ","+ total +","+ advance +")";
con = new OleDbConnection(s);
con.Open();
cmd = new OleDbCommand(query, con);
cmd.ExecuteNonQuery();
con.Close();
---------
Thanks in advance
Znaneswar
Reply
Answers (
1
)
Convert.ToDecimal(command.ExecuteScalar()) returns nothing
How to Clear DataGridView Rows?