Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Draus\Documents\Visual Studio 2012\WebSites\sampledb\Database5.accdb;")


Dim cmd As OleDbCommand = New OleDbCommand("SELECT F_Name FROM [Bowlers]", conn)



conn.Open()
Dim read As OleDbDataReader = cmd.ExecuteReader()
If read.HasRows Then
While read.Read()
Dim Fname As String = read.Item("F_Name")
End While
End If

End Sub
Posted

1 solution

It connects to a ms access database, retrieves the F_name column data from the Bowlers table and then iterates through it with a reader storing the data in a variable named FName. Strangely, it doesn't seem to do anything with the var, nor return it. Unless I am missing something it isn't doing anything permanent. Even if it did something with the FName variable, it would only have the value of the last row in the dataset.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900