Results 1 to 4 of 4

Thread: [2005] Retriving values from datafields

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    [2005] Retriving values from datafields

    I have the following code:


    Code:
                Dim st As String
                st = "SELECT ID FROM TABLE WHERE SECTION=1"
                Me.AccessDataSource1.SelectCommand = st
                Me.DataList1.DataBind()

    Now , how do I get the value of a the field ID , do I get it from the accessdatasource1 ? or from datalist1 ?



    I simply want to use IF statement before I bind the data to the Datalist1 depending on the ID

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Retriving values from datafields

    In that case, you would use a dataadapter and dataset. You would provide the dataadapter with your SQL statement and connection string. It connects to the database, gets your data back and fills it into the dataset.

    You can then go through the dataset and look at all the ID fields in there.

    You're looking for Oledbdataadapter and dataset. Finding code samples for these should not be difficult for you, unless you're really bad at using search engines.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: [2005] Retriving values from datafields

    Thanks mendhak , I'll will try google lol

  4. #4
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    Re: [2005] Retriving values from datafields

    But with AccessDataSource you won't need a connection string or any of that since it's doing it for you behind the scenes and is also using ole..blah.blah.blah...

    like this:

    Code:
    Dim st As String = "SELECT ID FROM TABLE WHERE SECTION=1"
    dim ads as AccessDataSource = new AccessDataSource(<path to your mdb file here>,st)
    
    me.DataList1.DataSource = ads
    me.DataList1.DataBind()

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