By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Selecting value of a single field

P: 132
Hello everybody,

I've got a little question about retrieving content from a database.

I have a table which has 4 columns: ID, NLText, FRText and ENText.

The basic idea is that the user can choose the language that he preferres and I just fill in the text in the chosen language upon loading the page.

In my code I tell him to select the appropriate columnname to be retrieved in the recordset.

When I try to fill in the content in the page I actually want to use the indexes value of the recordset. And that's where it goes wrong.

To make it all a bit more clear, here's a snippet of the code:

Expand|Select|Wrap|Line Numbers
  2. langSQL = "SELECT ENText FROM Language"
  3. Set lang = DBConnection.Execute(langSQL)
  4. ...
  6. <% =lang.fields.item(2) %>
In my column in my database I have 6 rows with text.
I was hoping to be able to read the text directly out of the recordset but I'm not sure if this is possible although I couldn't imagine it not being possible.

Who can point me in the right direction?

*** Edit ***
It just hit me that the fields aren't going to work obviously since these are the fields of the records.

What I would need is a way to select the different records of the recordset.

One way of doing this would be to loop through the Recordset and put all values into an array and then read from the array but I'm hoping that there will be an easier way of doing this.

May 9 '12 #1
Share this Question
Share on Google+
2 Replies

P: 132
Another update:

I realised that I had actually created my database in the wrong way.
I had 3 columns for the different languages and then a number of rows with the content in it.

Right now I changed it so that I have 3 rows with the languages and the content into different columns which makes it much more easy to handle because all of the content of a single language is now stores in a single recordset.

So my problem is solved, however if anybody knows if it is possible to select a single value out of a recordset with multiple rows without looping through it, then please do share.

May 9 '12 #2

Expert Mod 10K+
P: 12,369
Recordsets have a Move method that will move the location of the cursor a specified number or records. Although, you would be better off just using the WHERE clause of a query to filter down to the one row you need instead of returning everything and then moving to the row you need.
May 9 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.