New to .net Questions about ADO.net and oledb

PsYiOn

New member
Joined
Nov 8, 2008
Messages
1
Programming Experience
1-3
Hello Everyone,

I have been trying to get the hang of database connection in VB.net i used VB6 a long time ago and used to use DAO which was very simple to implement. As im now trying to learn .net iv been reading alot of posts on this forum trying to get some basic read/write code i can use to learn with.Currently this is what i have...

VB.NET:
Public Class Form1
    Dim con As New OleDb.OleDbConnection
    Dim cmd As New OleDb.OleDbCommand
    Dim da As New OleDb.OleDbDataAdapter
    Dim ds As New DataSet

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data.mdb;User Id=Admin;Password=; "
        cmd.Connection = con
        cmd.CommandType = CommandType.Text
        cmd.CommandText = "SELECT [Name], [Mobile] FROM Store"

    End Sub
End Class

I feel i have all of the variables declared but am not sure where to go now. I have placed my connection string and have room for my SQL statement which will let me select parts of teh table or multiple tables etc but how do i then use this data?

Can anyone show me some examples of say adding all of the names i have selected from the Store table to a listbox or combobox?

Kind Regards

PsYiOn

EDIT: just noticed this is inw rong forum, if a mod could kindly move it for me :) My Apologies
 
iv been reading alot of posts on this forum
Possibly not the right ones. In nearly every newbie data access post (and I respond to hundreds every month) I advocate reading the DW2 link in my signature, section Creating a Simple Data App. Please read this now, and it will answer all your questions and set you off on the right path
 

Latest posts

Back
Top