How to Create .mdb file from Excel file using C#.net

Last post 06-26-2009 2:12 AM by vsureshvarma. 2 replies.

Sort Posts:

  • How to Create .mdb file from Excel file using C#.net

    02-19-2009, 11:53 PM

    Hi all

    I want to create .mdb file that i have created excel feel from MS jet Database... through code behind

    Help me in this..

     

    Regards
    Ravi
    Please click "mark as answer" if this post helped you.
  • Re: How to Create .mdb file from Excel file using C#.net

    02-20-2009, 8:31 AM
    Answer

    How to create an mdb file programmtically:http://support.microsoft.com/kb/317881

    How to import Excel data into it: http://www.mikesdotnetting.com/Article.aspx?ArticleID=79

     

    Regards Mike
    [MVP - ASP/ASP.NET]
    My site    Please help - URGENT!!!    What ASP.NET can and can't do
  • Re: How to Create .mdb file from Excel file using C#.net

    06-26-2009, 2:12 AM
    • Member
      40 point Member
    • vsureshvarma
    • Member since 01-21-2009, 2:13 AM
    • Hyderabad
    • Posts 21

    Build an Access Database

    1. Open a new Visual C# .NET Application
    2. In Solution Explorer, right-click the References node and select Add Reference.
    3. On the COM tab, select Microsoft ADO Ext. 2.7 for DDL and Security, click Select to add it to the Selected Components, and then click OK.
    4. Delete all of the code from the code window for Class1.cs.
    5. Paste the following code into the code window:
      using System;
      using ADOX;

      In the event What ever u like
      {
      ADOX.CatalogClass cat = new ADOX.CatalogClass();

      cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" +
      "Data Source=D:\\AccessDB\\NewMDB.mdb;" +
      "Jet OLEDB:Engine Type=5");

      MessageBx.Show("Database Created Successfully");

      cat = null;

      }
      }
      }
Page 1 of 1 (3 items)