473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Request.querystring or Recordset.GetString?

I am still very new to ASP and am trying to create an ASP page that gets
records from a database. Right not I can successfully get one field of
information at a time and randomize it, but I need the whole string. I've
been searching the internet trying to find an answer to this question and I
found these two commands Request.querystring and Recordset.GetString, but I
don't think I know how to use them properly.

Here's the code I have now:

====================

‘Connection String and SQL statement

Dim query, connStr

query = “select * from numbers”

connStr = “Provider=Microsoft.Jet.OLEDB.4.0;” & _

“Data Source = F:\Inetpub\wwwroot\numbers.mdb;”

‘Opening Database

Dim rs

Set rs = Server.CreateObject(“ADODB.Recordset”)

rs.Open query, connStr, 3, , adCmdText

‘Generating random number from total number of records

Dim intRnd

Randomize Timer

intRnd = (Int(RND * rs.RecordCount))

‘Now moving the cursor to random record number

rs.Move intRnd

‘Showing the random statement

Response.Write “<b>” & rs(“ID”) & “</b>”

‘Closing the database

rs.Close

Set rs = Nothing

====================

Any help would be greatly appreciated, I'm running short on time.

~Andrew
Jul 22 '05 #1
1 3297
I don't think you want either of those, but I'm not quite clear on what "but
I need the whole string" means.

you're successfully writing the ID field, right? does this mean you want to
write another field too?

in that case:

Response.Write "<b>" & rs("ID") & " : " & rs("anotherfieldnamehere") &
"</b>"

Recordset.GetString() is a method for fast data retrieval that will convert
the WHOLE recordset into a string. I don't think you want that, since you're
grabbing one row, not all. Request.Querystring gets you the query string
from a URL (the bit after ? in http://support.microsoft.com/?kbid=123456 -
Request.Querystring("kbid") would return "123456")
--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no
rights.
"andrewdreib" <an*********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I am still very new to ASP and am trying to create an ASP page that gets
records from a database. Right not I can successfully get one field of
information at a time and randomize it, but I need the whole string. I've
been searching the internet trying to find an answer to this question and
I
found these two commands Request.querystring and Recordset.GetString, but
I
don't think I know how to use them properly.

Here's the code I have now:

====================

'Connection String and SQL statement

Dim query, connStr

query = "select * from numbers"

connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source = F:\Inetpub\wwwroot\numbers.mdb;"

'Opening Database

Dim rs

Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open query, connStr, 3, , adCmdText

'Generating random number from total number of records

Dim intRnd

Randomize Timer

intRnd = (Int(RND * rs.RecordCount))

'Now moving the cursor to random record number

rs.Move intRnd

'Showing the random statement

Response.Write "<b>" & rs("ID") & "</b>"

'Closing the database

rs.Close

Set rs = Nothing

====================

Any help would be greatly appreciated, I'm running short on time.

~Andrew

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
2
by: Roland Hall | last post by:
I have two(2) issues. I'm experiencing a little difficulty and having to resort to a work around. I already found one bug, although stated the bug was only in ODBC, which I'm not using. It...
5
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As...
18
by: Darryl Kerkeslager | last post by:
When I open an ADO Recordset, I close it. However, it seems that there may be some difference in this manner of opening a Recordset: Dim rL As ADODB.Recordset Set rL = New ADODB.Recordset ...
2
by: mahsa | last post by:
Hi have have some link like thi http://x.com/Shoppingcart.aspx?pn=ps50210&qty_ps50210=1&pn=excel&qty_excel=1&pn=l4504000&qty_l4504000=1&sku=PS50210&cat=laminate&action=updat now I want to request...
15
by: gjoneshtfc | last post by:
Hello, I have a simple problem that I just cannot get my head around! I currently have the following line in my ASP recordset: Recordset1.Source = "SELECT * FROM MainTable ORDER BY Price ASC"...
2
by: Kim | last post by:
How do I get all walues if my querystring is empty? If I have a table with let's say 10 rows/records, (ID 1-10). I then have a recordset with request.querystring("id") and get the record having the...
5
by: magix8 | last post by:
Hi, I have form GET method, example: index.asp?Type=1&Type=3&Type=4&.... So, I have something like this at the receiver side to retrieve multiple Type value and insert into tables.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.