1,105,456 Community Members

Using Database with VB.NET

Member Avatar
RaoxFaello
Newbie Poster
9 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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?

Member Avatar
Ancient Dragon
Achieved Level 70
27,602 posts since Aug 2005
Reputation Points: 5,232 [?]
Q&As Helped to Solve: 3,032 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

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

Member Avatar
Reverend Jim
Noli mentula
5,418 posts since Aug 2010
Reputation Points: 746 [?]
Q&As Helped to Solve: 648 [?]
Skill Endorsements: 51 [?]
Moderator
Featured
 
0
 

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.

Member Avatar
TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418 [?]
Q&As Helped to Solve: 152 [?]
Skill Endorsements: 16 [?]
 
0
 

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

Member Avatar
Ancient Dragon
Achieved Level 70
27,602 posts since Aug 2005
Reputation Points: 5,232 [?]
Q&As Helped to Solve: 3,032 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

@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.

Member Avatar
TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418 [?]
Q&As Helped to Solve: 152 [?]
Skill Endorsements: 16 [?]
 
0
 

@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.

Member Avatar
Ancient Dragon
Achieved Level 70
27,602 posts since Aug 2005
Reputation Points: 5,232 [?]
Q&As Helped to Solve: 3,032 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

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.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article