Community discussion forum

how to get all employee ids into array?

Tags: .net, asp.net, db India
  • 1 year ago

    hai all,
        i am new to .net.i am using .net 2005.i do my project in asp.net.backend is sql2000.
    all employee ids are stored in sql 2000 database.
    i want to get all employee ids from database and stored into single array name.then using that array name,i want to display the details of all employee ids in datagridview....how to do this?....
    thanks in advance...

  • 1 year ago

    Hi,

    I dont think you need to use an array, a dataset will do the job for you.

    you could use a construct such as this (you will need to tailor this to your scenario - i develop in oracle, so forgive me if i get some of the classes wrong)

    [CODE]

    Dim sqlDS as dataset = new dataset 
    using sqlConn as SQLConnection = new SQLConnection({your connection string here})
    using sqlCom as SQLCommand = new SQLCommand({Your select SQL here}, sqlConn)
    using sqlAdapter as sqlDataAdapter = new sqlDataAdapter(sqlCom)
    sqlCom.Connection.Open()
    sqlAdapter.fill(sqlDS)
    sqlCom.Connection.Close
    End Using
    End Using
    End Using
    gdvDetails.datasource= sqlDS
    gdvdetails.DataBind()

    [/CODE]

    Does that make sense?

    Regards

    Simon C

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback