Results 1 to 2 of 2

Thread: Retrieve value using SQL Statement to OleDbDataReader [resolved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Retrieve value using SQL Statement to OleDbDataReader [resolved]

    I am using an AVG function in SQL
    VB Code:
    1. Dim myCommand2 As New OleDb.OleDbCommand( "SELECT AVG(diastolic)from cycles", myConnection)

    Then I use this code:
    VB Code:
    1. myReader1 = myCommand2.ExecuteReader
    2.         If myReader1.Read = True Then
    3.             Label6 = myReader1.Item(0)
    4.         End If
    5.  
    6.         myReader1.Close()

    but it gives me "specified cast is not valid" error!
    Any ideas??

    Thanks,
    Bebandit


    Ok...Got it
    Label6.Text = (myReader.GetDouble(0).ToString())
    because it is a long integer that i am retrieving....
    Last edited by bebandit; Jan 26th, 2004 at 10:53 AM.

  2. #2
    Addicted Member
    Join Date
    Apr 2002
    Location
    California
    Posts
    160
    label16.text
    Jason Moore

    Software Engineer, Database Architect, Web Designer

    (C#,VB/NET,ASP/NET,COLDFUSION,JAVASCRIPT,SQL)

    http://www.gatorstudios.com
    [email protected]

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