Hi, I'm currently studying this language how do i connect VB.NET with a Database (MS Access) and let me input informations in it as well as retrieve informations from it?

I'm not familiar with MS Access but i know how to enter the name and it's type so that i can input informations in them (Name: Numbers Type: Integer something like that.) and also what's a Primary Key?

Recommended Answers

All 6 Replies

First you will have to learn fundamentals of SQL (Structured Query Language), which is the language used by Access and other databases such as MySQL, Oracle, Sybase and MS SQL (there are lots of others too). If you already know that then go on to reading a tutorial. Here is a link that has other links to Microsoft tutorials

The most common connections are

  1. ADO
  2. SqlClient
  3. OLEDB

ADO is the underlying connection behind both SqlClient and OLEDB but provides only basic functionality. SqlClient is used for connecting only to SQL databases but has the advantage of supporting named parameters (don't worry about that for now). OLEDB is the most generic (it can be used to connect to SQL, Access, Excel, CSV, etc) and also supports parameters (but not named ones). To connect to a data source you specify the connection information via a connection string which varies depending on the data source type and location. The web site I just linked to details many many sample connection strings.

You are on the right track by acknowledging that you need to learn how to do this versus the all to common "I want code that does this and I have no intention of ever understanding it".

This site is an excellent starting point.

Visual Basic .NET Programming for Beginners

I suggest that even if you belivee you have mastered the beginning material that you at least scan through it. The database stuff is in section 13 of 14. This fact alone should indicate to you that such coding requires an uderstanding of the fundamentals.

ADO.Net provides a consist set of tools to access data regardless of the data provider (SQLServer, MySql, OleDb, etc.) so it behooves you to read through this. I suggest you pay particular attention to the section on datasets. They can make your database coding a much more pleasant experience once learn how to crreate and use the through the IDE.

ADO.NET Overview

@TnTinMN: I have that ebook, found it very helpful. The free online version doesn't include the chapters about database programming, so he will have to buy the ebook.

@TnTinMN: I have that ebook, found it very helpful. The free online version doesn't include the chapters about database programming, so he will have to buy the ebook.

@AD. LOL, you made me look again, because it did the the last time I looked. I know they supposedly have more info in their e-book, but the basic stuff is still there. In any case, it would be a good low cost reference.

You are right, the free online version just doesn't include a few pages about datagrids and some other topics. In any event it is still a good introduction to vb.net programming.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.