Click to See Complete Forum and Search --> : From Database to Table
Iceman5
Dec 11th, 2003, 09:51 AM
I´m trying to read from a database and put the info (name and percent) into a table, where I want the one with highest percent to be at the top.
But I´m not sure on how to read from the database
Can anyone show an example?
I got a database named skitgubbe.mdb
Thanks for answers
Memnoch1207
Dec 11th, 2003, 10:51 AM
What language are you doing this in?
Iceman5
Dec 11th, 2003, 03:29 PM
I want a webapplication. So I was thinking on combine asp with VB.
Thanks
Memnoch1207
Dec 11th, 2003, 04:57 PM
Dim Conn As OleDbConnection
Dim Cmd As OleDbCommand
Dim reader As OleDbDataReader
Conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\somePath\mydb.mdb;User Id=;Password=;")
Cmd = New OleDbCommand("SELECT fieldName FROM tableName", Conn)
Try
Conn.Open()
reader = Cmd.ExecuteReader()
While (reader.Read())
Response.Write(Convert.ToString(reader("fieldName")) & "<br>")
End While
reader.Close()
Conn.Close()
Catch ex As Exception
Response.Write("Error Occurred: " & ex.Message)
End Try
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.