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
Dipesh Tare
NA
101
33.4k
Getting error into Update query
Jul 10 2014 3:40 AM
Below code is for update the record in excel sheet:-
try
{
System.Data.OleDb.OleDbConnection MyConnection;
System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
string sql = null;
MyConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\\csharp.net-informations.xlsx;Extended Properties=Excel 12.0 Xml;");
MyConnection.Open();
myCommand.Connection = MyConnection;
sql = (@"Update [Sheet1$] set (candidatefname='" + txtFName.Text + "', candidatemname='" + txtMName.Text + "', candidatelname='" + txtLName.Text + "', dob='" + dtpDOB.Value + "', sex='" + cmbSex.Text + "', currentaddress='" + txtCurrentAddress.Text + "', permanentaddress='" + txtParmanentAddress.Text + "', mobilenumber='" + txtMobile.Text + "', mailid='" + txtMailID.Text + "', maritalstatus='" + cmbMaritalStatus.Text + "', experience='" + txtExperience.Text + "', departmentname='" + cmbDepartment.Text + "') where SrNo='" + cID + "' ");
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
MyConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
I am getting the error : Syntax error in UPDATE statement.
When I am debugging the code getting all the value perfectly as I want, but in sql object I am getting null value.
So please can anybody tell me what is wrong with this?
Reply
Answers (
3
)
calculte the salary for present days in asp.net using c# lan
Kendo Menu not rendering properly in IE