Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
11
Reply
Error - Insert data into Access database in c#
Oyetoke Toby
Jul 11 2016 5:25 AM
508
Reply
Pls, am having an error code when inserting data into Access database. It keeps saying there's sytank error in my INSERT INTO statement. Can any one help me to solve this.
Here is the code
try
{
OleDbConnection connection =
new
OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\Users\DELL\Documents\EmployeesData.accdb;
Persist Security Info =
false
;");
connection.Open();
OleDbCommand cmd =
new
OleDbCommand(
"insert into EmployeeInfo (UserName, Password)values('"
+ UserText.Text +
"', '"
+ PassText.Text +
"')"
, connection);
cmd.ExecuteNonQuery();
MessageBox.Show(
"Inserted"
);
}
catch
(Exception ex)
{
MessageBox.Show(
"Failed"
+ ex.ToString());
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
11
)
Next Recommended Forum
COncept of Methods
What is the logic when we make copy of copy