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
Adace Gavril Marius
NA
8
0
insert problem
Jun 14 2007 5:09 AM
i have a button witch should insert into a database table 3 strings from textboxes this is the code but not working :( { string stringconexiune = @"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=Users.mdb"; OleDbConnection conexiune = new OleDbConnection(stringconexiune); conexiune.Open(); OleDbCommand comanda = new OleDbCommand("INSERT INTO Users (Username, Password, Login) VALUES ('"+this.textBox1.Text+"', '"+this.textBox2.Text+"', '"+this.comboBox2.Text+"')", conexiune); comanda.ExecuteNonQuery();// here seems to be the problem conexiune.Close(); } when i click the buton in the project i have this exception System.Data.OleDb.OleDbException was unhandled Message="Syntax error in INSERT INTO statement." Source="Microsoft JET Database Engine" ErrorCode=-2147217900 StackTrace: at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Catalog.Catalog3.button4_Click(Object sender, EventArgs e) in D:\Programare\c#\CATALOG\Catalog\Catalog\Catalog3.cs:line 68 what shoud i do?? is there an error in my command OleDbCommand comanda = new OleDbCommand("INSERT INTO Users (Username, Password, Login) VALUES ('"+this.textBox1.Text+"', '"+this.textBox2.Text+"', '"+this.comboBox2.Text+"')", conexiune);
Reply
Answers (
3
)
Dataset?
Truncating size of byte[] data to 2000 when insert data into Oracle DB