Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8516105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:19:44+00:00 2026-06-11T05:19:44+00:00

I am trying to connect to access 2010 database using the following string connection.

  • 0

I am trying to connect to access 2010 database using the following string connection. But, it wont make any changes in the database.

OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=C:\\Program Files\\LogEntry\\LogEntry.accdb; Persist Security Info = False;");

conn.Open();

String text2send = "INSERT INTO TLC(Name,Department,Position,VisitDate,InTime,OutTime,Purpose,HelpedBy,Campus,HelpCode) VALUES(" + name + "," + department + "," + position + "," + date + "," + hourIn + "," + hourOut + "," + purpose + "," + helpedBy + "," + campus + "," + helpcode + ");";

OleDbCommand cmd = new OleDbCommand(text2send,conn);
conn.Close();

Edit:
This is the edited code that I used with Parameter query.

 String name = nameTextbox.Text;
 String department = departmentCBox.Text;
 String purpose = purposeTextbox.Text;
 String position = positionCBox.Text;
 String date = inDate.Value.ToString("MM/dd/yyyy");
 String helpCode = helpCodeCBox.Text;
 String hourOut = ""+OutHour.Text+":"+OutMin+" "+OutMeredian;
 String helpedBy= "";
 String campus= "";
 String helpcode= "";
 String hourIn = "" + DateTime.Now.ToString("hh") + ":" + 

 DateTime.Now.ToString("mm") + " " + DateTime.Now.ToString("tt");

 OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=C:\\Program Files\\LogEntry\\LogEntry.accdb; Persist Security Info = False;");
            conn.Open();


 String text2send = "Insert Into TLC([Name],[Department],[Position],[VisitDate],[InTime],[OutTime],[Purpose],[HelpedBy],[Campus],[HelpCode]) VALUE(?,?,?,?,?,?,?,?,?,?);";

 OleDbCommand cmd = new OleDbCommand(text2send,conn);
 cmd.Parameters.AddWithValue("Name", name);
 cmd.Parameters.AddWithValue("Department", department);
 cmd.Parameters.AddWithValue("Position", position);
 cmd.Parameters.AddWithValue("Purpose", purpose);
 cmd.Parameters.AddWithValue("HelpedBy", helpedBy);
 cmd.Parameters.AddWithValue("Campus", campus);
 cmd.Parameters.AddWithValue("HelpCode", helpcode);

 cmd.ExecuteNonQuery();
 conn.Close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:19:46+00:00Added an answer on June 11, 2026 at 5:19 am

    add cmd.ExecuteNonQuery(); after your command is created and before you close the connection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to connect to an access database from a php script using ODBC.
I'm trying to connect an Access DB (2010 32-bit) to a System ODBC connection
I'm trying to connect to remote MySQL database using PDO, but it fails with
I'm trying to connect to a mysql database using Connector/J but get the same
I'm trying to connect to a FTP using Apaches FTPSClient but I keep getting
I'm trying to connect to an existing database (non-SQLEXPRESS) but everytime I try to
I'm trying connect me to database MySQL server but the console show me ERROR
I'm trying to connect a DataGridView to an access 2000 database on Visual Studio
I am trying to connect to my company database but keep on getting authentication
I am trying to connect to a remote MySQL database using Visual C# 2008

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.