Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Single Value from 1

Status
Not open for further replies.

requested89

IS-IT--Management
Sep 6, 2005
44
GB
How do I get a single value from the below record set. I don't care if I get it from the datatable or dataset or even if a nice flying Stork comes and drops it in my backgarden I just want to be able to get the value of the field imageName from the database.

Code:
oConn = New OleDbConnection(ConfigurationSettings.AppSettings("DBConnString_Cav"))
                queryString = "SELECT imageName FROM contentTable WHERE "& menuCol &" = "& contentID &" ORDER BY contentID DESC"

                oContentRS = New OleDbDataAdapter(queryString, oConn)

                oContentRS.Fill(oContentDS,"ContentDS")
                ContentDT = New DataTable
                ContentDT = oContentDS.Tables(0)
                ContentDT_numrows = ContentDT.Rows.Count
                cntRpt.datasource = oContentDS
                cntRpt.databind()

Thanks in advance this is really annoying me.

Chris
 
you can use Executesclar it retuns only one row from first column.
 
Not sure what you are asking. You are retriveing the values then binding the dataset to some object. The results will be shown there, so I am unclear as to what you want to do.

Jim
 
I want to be able to:

1) retrieve the values
2) bind to a repeater
3) use one value in an if statement completely unconnected with the object. For i.e. compare the value of imageName to some other variable or string. It doesn't matter at what point I use this value i.e I could do the comparison as step 2 and then bind the data in step 3 if need be.

Is this possible?

Thanks for your help,

Chris
 
To the the value from the dataset:
Code:
Dim somevar As datatype
somevar  = oContentDS.Tables("ContentDS").Rows(rownumber).Item(<columnname>)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top