Results 1 to 2 of 2

Thread: [2005] MS Access with .net 2.0?

  1. #1

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    [2005] MS Access with .net 2.0?

    hey guys, used to access ms sql servers, and I was just wondering on what would change when I need to use ms access instead with .net 2.0?

    sample code for dtb connection with ms sql server:

    Code:
    String conString;
    SqlConnection con;
                ServerName = Server;
                conString = "Data Source=" + Server + ";";
                if (User == null)
                {
                    conString += "Integrated security = true;";
                }
                else {
                    conString += "User ID="+ User +";";
                    conString += "Password=" + Password + ";";
                }
                try
                {
                    con = new SqlConnection(conString);
                    con.Open();
                    tsStatus.Text = "Connection établie.";
                    ActivateControls();
                }
    (I know, sample is in c#, but w-e, post vb, .net is .net and this is the most popular thread... )

    Also, if I need other objects instead of the System.Data.SqlClient library, please mention the references needed...

    basically what I need to do is just to retreive rows from tables of an ms access file (in asp.net, but again w-e .net is .net )

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] MS Access with .net 2.0?

    ADO.NET is virtually identical regardless of the data source. For Access you use OleDb instead of SqlClient. Both namespaces have corresponding types, e.g. SqlConnection <=> OleDbConnection. See www.connectionstrings.com for the appropriate connection string format if required.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width