[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
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. :)
Re: [2005] Retriving values from datafields
Thanks mendhak , I'll will try google lol
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()