DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: how to know the max(no) value??

  1. #1
    pilsung Guest

    how to know the max(no) value??

    sqlconnection1.open()
    sqlcommand1.text = "selelct max(no) from member"

    Then,How do I to know the max 'no' value??




  2. #2
    Srinivas Kotipalli Guest

    Re: how to know the max(no) value??

    You have to use ExecuteScalar method of sqlCommand. Like..........
    dim x as Integer
    x = sqlcommand1.ExecuteScalar()

    Variable 'x' will now hold the value returned by the command.

    "pilsung" <youthcom@interpia98.net> wrote in message
    news:3d023f6c@10.1.10.29...
    > sqlconnection1.open()
    > sqlcommand1.text = "selelct max(no) from member"
    >
    > Then,How do I to know the max 'no' value??
    >
    >
    >




  3. #3
    Robin Hildawa Guest

    Re: how to know the max(no) value??


    try this:

    dim rs as new adodb.recordset

    rs.open "SELECT MAX(NO) as nMAX from MEMBER",cnStr, ....
    nMax = rs("nMAX")



    "pilsung" <youthcom@interpia98.net> wrote:
    >sqlconnection1.open()
    >sqlcommand1.text = "selelct max(no) from member"
    >
    >Then,How do I to know the max 'no' value??
    >
    >
    >



  4. #4
    David A. Rothgery Guest

    Re: how to know the max(no) value??

    Robin Hildawa <rphildawa@yahoo.com> wrote:

    While that's the canonical VB6 solution, and will work in VB.NET via COM
    interop, the ADO.NET solution posted earlier is preferred.

    > try this:
    >
    > dim rs as new adodb.recordset
    >
    > rs.open "SELECT MAX(NO) as nMAX from MEMBER",cnStr, ....
    > nMax = rs("nMAX")
    >
    >
    >
    > "pilsung" <youthcom@interpia98.net> wrote:
    > >sqlconnection1.open()
    > >sqlcommand1.text = "selelct max(no) from member"
    > >
    > >Then,How do I to know the max 'no' value??
    > >
    > >
    > >

    >
    >


    --
    Dave Rothgery
    Picking nits since 1976
    drothgery@alum.wpi.edu
    http://drothgery.editthispage.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center