473,796 Members | 2,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.queryst ring or Recordset.GetSt ring?

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.queryst ring and Recordset.GetSt ring, 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=Mic rosoft.Jet.OLED B.4.0;” & _

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

‘Opening Database

Dim rs

Set rs = Server.CreateOb ject(“ADODB.R ecordset”)

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 3313
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("anotherfiel dnamehere") &
"</b>"

Recordset.GetSt ring() 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.Queryst ring gets you the query string
from a URL (the bit after ? in http://support.microsoft.com/?kbid=123456 -
Request.Queryst ring("kbid") would return "123456")
--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no
rights.
"andrewdrei b" <an*********@di scussions.micro soft.com> wrote in message
news:B6******** *************** ***********@mic rosoft.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.queryst ring and Recordset.GetSt ring, 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=Micro soft.Jet.OLEDB. 4.0;" & _

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

'Opening Database

Dim rs

Set rs = Server.CreateOb ject("ADODB.Rec ordset")

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
10336
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 120''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
4
2742
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 to my system, the current admin user logged in gets logged out. I can't seem to work out how - I can't even trace back where some of the variables are coming from (for example, the "ref" part of the Request.QueryString method). Could someone...
2
10700
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 appears to be in the OLEDB driver also. My connection was: conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & ";" & "Extended Properties='Text;HDR=NO;FMT=Delimited'"
5
29854
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 Long) As Boolean Dim rsAssignedUser As ADODB.Recordset Dim strSelectUser As String
18
6149
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 src = "SELECT Count(*) FROM reviewer INNER JOIN pp_officer " & _ "ON reviewer.reviewer_id = pp_officer.ppo_rev_id " & _ "WHERE rev_login = 'EllisonL'" Set rL = CurrentProject.Connection.Execute(src, , adCmdText)
2
1844
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 the dat I use this code in as <%For Each strPartNo In Request.QueryString("pn" lngQty = Request.QueryString("qty_" & strPartNo strPartNo = LCase(strPartNo Response.Write("strPartNo"& strPartNo& lngQty Next %
15
2981
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" I have the following code at the start of the recordset: dim chosencar chosencar=Request.QueryString("make")
2
7399
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 id thats shown in the address bar ("..com?id=4" would get the record with the id 4). How do I get all records if the querystring is empty ("..com") I have: <% Dim rs_yadayada
5
3586
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
9684
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9530
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10236
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10182
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.