Results 1 to 4 of 4

Thread: From Database to Table

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    62

    From Database to Table

    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
    //Martin Andersson

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    What language are you doing this in?
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    62
    I want a webapplication. So I was thinking on combine asp with VB.
    Thanks
    //Martin Andersson

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    VB Code:
    1. Dim Conn As OleDbConnection
    2. Dim Cmd As OleDbCommand
    3. Dim reader As OleDbDataReader
    4.  
    5. Conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\somePath\mydb.mdb;User Id=;Password=;")
    6. Cmd = New OleDbCommand("SELECT fieldName FROM tableName", Conn)
    7.  
    8. Try
    9.         Conn.Open()
    10.         reader = Cmd.ExecuteReader()
    11.  
    12.         While (reader.Read())
    13.               Response.Write(Convert.ToString(reader("fieldName")) & "<br>")
    14.         End While
    15.  
    16.         reader.Close()
    17.         Conn.Close()
    18. Catch ex As Exception
    19.         Response.Write("Error Occurred: " & ex.Message)
    20. End Try
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width