C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




C#+ update dtabase error


Posted Date: 06 Jul 2008      Total Responses: 1

Posted By: radhika bista       Member Level: Gold     Points: 1


hi all
i can not understand whats the problem with my code
string update_cmd= string.Format("Update tbl_user Set password='"+new_password.Trim()+"' Where user='"+user.Trim()+"'");

OleDbCommand cmd_91 = new OleDbCommand();

cmd_91.CommandText = update_cmd.Trim();

cmd_91.Connection = con;

i always get Syntax error in update command error.

Thanks




Responses

Author: M. Irfan    06 Jul 2008Member Level: GoldRating:     Points: 5
you are using sql statement which includes a keyword which is reserevd

use like this
string update_cmd= string.Format("Update tbl_user Set [password]='"+new_password.Trim()+"' Where user='"+user.Trim()+"'");

OleDbCommand cmd_91 = new OleDbCommand();
cmd_91.CommandText = update_cmd.Trim();
cmd_91.Connection = con;


use password as [password]

Hope this helps
http://matespoint.blogspot.com



Post Reply
You must Sign In to post a response.
Next : rell me about custome controls and usedefined control ? both are same or not?
Previous : C#+ deployment+ database path
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing

Contact Us    Privacy Policy    Terms Of Use