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

  • SEARCH
  • Home
  • 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 9318157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:02:50+00:00 2026-06-19T03:02:50+00:00

I get an error about ExecuteNonquery is not initialized . And I think may

  • 0

I get an error about ExecuteNonquery is not initialized.

And I think may be connecting to the database wrong because the MessageBoxis not appearing before executing the system.

//Server Connection
private void ServerConnect()
{

    string ConnString;
    ConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=PLAN.accdb";
    TConn = new OleDbConnection(ConnString);
    TConn.Open();
    MessageBox.Show("You Are Connected.");
}

//ADD MEMOS
private void GetMemoList()
{

    string query;
    DataSet ds = new DataSet();
    query = "SELECT MEMOS_ID,DATE,TIME,MEMOS FROM TBLMEMOS ORDER BY DATE ASC";
    OleDbDataAdapter da = new OleDbDataAdapter(query, TConn);
    da.Fill(ds);
    this.dgv1.DataSource = ds.Tables[0];
}

private void AddMemo(string MemoDate, string MemoTime, string Memos)
{

    string acc;
    acc = "INSERT INTO TBLMEMOS (DATE,TIME,MEMOS) VALUES ('" + MemoDate + "','" + MemoTime + "','" + Memos + "')";
    OleDbCommand cmd = new OleDbCommand(); 
    cmd.CommandText = acc;
    cmd.Connection = TConn;
    cmd.ExecuteNonQuery();
}

private void btnAddMemos_Click(object sender, EventArgs e)
{

    AddMemo(this.dtpDate.Value.ToShortDateString(), this.dtpTime.Value.ToShortTimeString(), this.txtInfo.Text.Trim());
    GetMemoList();
    txtInfo.Clear();
}
  • 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-19T03:02:52+00:00Added an answer on June 19, 2026 at 3:02 am

    Try adding parameters like this.

    cmd.Parameters.Add("p1", OleDbType.Char).Value = MemoDate ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get an error in my code: ExecuteNonQuery: Connection property has not been initialized.
I get this error about casting from type A to type B because the
This one puzzles me. I get an error about seek when I'm not even
In Scala IDE I get the following error about the class I am to
I get a compile error, which I'm slightly confused about. This is on VS2003.
Why do I get error in this code?Even if i do not link but
Why I get error with this query on my live server but not on
I get this error about my routes file SystemStackError (stack level too deep): actionpack
When running my application I sometimes get an error about too many files open
In my simple OpenGL program I get the following error about exit redefinition: 1>c:\program

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.