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 7819983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:08:25+00:00 2026-06-02T07:08:25+00:00

This is my code that creates an .accdb file if it can’t find one

  • 0

This is my code that creates an .accdb file if it can’t find one :

Catalog cat = new CatalogClass();
string createStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|/saveDB.accdb;";
cat.Create(createStr);
Table tbl = new Table();
tbl.Name = "saveDB";
tbl.Columns.Append("ID", DataTypeEnum.adGUID);
tbl.Columns.Append("Tensiune", DataTypeEnum.adDouble);
tbl.Columns.Append("Frecventa", DataTypeEnum.adDouble);
tbl.Columns.Append("Rezistenta", DataTypeEnum.adDouble);
tbl.Columns.Append("Inductanta", DataTypeEnum.adDouble);
tbl.Columns.Append("Capacitate", DataTypeEnum.adDouble);
tbl.Columns.Append("Elemente", DataTypeEnum.adVarWChar, 25);
tbl.Columns.Append("Tip", DataTypeEnum.adVarWChar, 25);
cat.Tables.Append(tbl);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(tbl);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat.Tables);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat.ActiveConnection);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat);

But when I run it in the program i get this runtime error :

System.Runtime.InteropServices.COMException (0x80004005): Not a valid file name.
   at ADOX.CatalogClass.Create(String ConnectString)

I can’t figure what’s the problem with the file name, so if anyone has any idea, please help.

  • 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-02T07:08:28+00:00Added an answer on June 2, 2026 at 7:08 am

    Well, i finally found a workaround based on Killercam’s idea he posted in the comments and i’ll post it here in case someone needs it sometime.
    Build the connection string like this :

    Catalog cat = new CatalogClass();
    string cntPath = System.IO.Directory.GetCurrentDirectory();
    string createStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + cntPath + "\\saveDB.accdb;";
    cat.Create(createStr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function in a Code Igniter model that creates a new video.
I have all of this code that creates new divs and adds innerHTML. Within
I'm trying to turn this C++ code/answer (class that creates map string <-> some_array_of_predefined_function_types
I have this code that reads a file and creates Regex groups. Then I
Well ive got this code that creates a table from JSON data. If a
I have this JavaScript code that creates a table, and puts in the rows
I have the this code that will create excel file and work sheet then
Challenge: I have this code that fails to compile. Can you figure out what's
I currently have this code that creates 4 tabs using tabactivity: public class toknapp
So i have this code that creates two windows: WNDCLASS wc; wc.style = CS_BYTEALIGNCLIENT

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.