Select Random Word From File
While i'm here, do you know how to select a random word from a text file?
Txt file is like this:
word 1
word 2
etc.
While i'm here, do you know how to select a random word from a text file?
Txt file is like this:
word 1
word 2
etc.
I have the following select statement, but need to randomise the results to draw just 1 record at a time for banner displaying. How can I do it? ....
View Replies View Relateddoes exist any command to get random row from target table in target database and then use this row ?
View Replies View RelatedI have 30 numbers. I need to select randomly 10 out of the given 30. A number must not repeat ( eg. i can't have number 10 twice ). How can i do this??
View Replies View RelatedOk here is what I'm trying to do. I want to grab a random record from a specific table. This is how I am doing it now:
x = 0
Set rs = Conn.Execute("SELECT Count(*) as total FROM [user] WHERE active = '1'")
If rs.EOF <> True then
total = rs("total")
End if
Randomize timer
randnum1 = int(rnd * total)
If randnum1 = 0 then
randnum1 = 1
End if
rs.close
set rs = nothing
Set rs = Conn.Execute("SELECT * FROM [user] WHERE id = '" & randnum1 & "' ")
Now that would work fine, BUT the id is a autonumber int of 1.
Now look at this example. Let's say I have 50 records, so I have the ID values of 1 through 50. Now I delete record number 46. So now my count goes up to 49. So the random number will pull up ANY number between 1 and 49, so if it pulls up 46 then BAAAM record can not be found.
There has to be an easier/more efficient way of getting a random record. I don't plan on deleting any records, but I just don't feel this is the best way of doing this.
I want to select 5 random records from my database..I tried to suft the net and foundout this sql
SELECT TOP (3) Question, Choice1, Choice2, Choice3, Choice4
FROM Question
But when i tried to execute,i t always gave me the most top 2 records. why?Is this sql statement woring?How can i select 5 random records from the database?
<%
Dim oConn, oRS, randNum
Randomize()
randNum = (CInt(1000 * Rnd) + 1) * -1
Set oConn=Server.CreateObject("ADODB.Connection")
Set oRS=Server.CreateObject("ADODB.recordset")
oConn.Provider="Microsoft.Jet.OLEDB.4.0"
oConn.Open Server.MapPath("temp.mdb")
oRS.Open "SELECT TOP 1 EMAIL_ADDRESS, r = Rnd(" & randNum & ") FROM TABLE1 ORDER BY r", oConn, adOpenStatic, adLockReadOnly
Response.Write oRS("EMAIL_ADDRESS")
oRS.close
oConn.close
Set oConn = nothing
Set oRS = nothing
%>
this gives the error: "No value given for one or more required parameters".
what i would really LOVE is for someone to fill in whatever required parameter im missing, but more important i would like to understand whats going on. there are people who go through life dumb and happy once something "works", but i need to understand how and why its working. even if this code did work, im confused with the SELECT statement (no, i dont have much SQL experience aside from basic queries). what is the "r = Rnd" line doing in the middle of the querie? how am i ordering by r?? also, i dont have an indexed, primary "ID" field in this databae. is that ok for this code to work?
I need to generate three random numbers between 1 and 100, but they need to be different.
e.g. 3,43,88 would be fine but 5,76,76 would not.
The function I have to generate a single random number is:
function funRandomNumber(intHighestNumber)
randomize
funRandomNumber = int(rnd * intHighestNumber) + 1
end function
called by: funRandomNumber(100)
Can anyone see how this can be modified to do what I need?
I have a select droplist to list the states. I notice that when i submit the form to store the selected states, only a portion of the data is being stored. e.g if i choose 'New York', i found that only 'New' is being captured and store in to a table. This happends if there is a space between the words. Code:
View Replies View RelatedI have a file where i want to call a random asp file using the "include file" statement. I know it can be done with images, but can it be done with other asp files? and how?
View Replies View RelatedI would like to know if I have a word document on asp, how would I read it's actual content rather than the binary data.
View Replies View RelatedI m working on the application wherein I am requiered to display the local word file from the client side on the client system.
I have tried it by redirecting to the file with the local path but it is giving the 'Access Denied' error.
I am having trouble displaying a word file. Following is the code I am using.
Response.ContentType = "application/msword"
Response.Addheader "Content-Disposition", "attachment;filename=hostsfile.doc"
It opens Word but the page is blank. What am I doing wrong?
I have manage to create a word doc from lotus notes using the createobject("Word.Application"). Now I wanted to add some text in a field on the template. I want to know how to insert a newline in the field.Also I have created a table in the doc file, now i wanted to know how to place at a desired position in the file.
View Replies View RelatedI want that when the user writes a story (some content) in the textarea...it sould get saved as a word file. Actually the concept is that the student writes a story in textarea and submits.
But when teacher views that story he should be able to open it as a doc file so as to make some corrections like strikethrough, highlight etc. So what I want is that the story should be saved as a doc file in database...can it be possible?
Now I wanted to do some office automation in my web page. Let say I have the microsoft word named report.doc. In this report.doc , I wanted to put the number in header or footer from the parameter in my asp file. How do I do that?
View Replies View RelatedI need to search ms word file with ASP, and find a couple of predefined words. such as "apple" "mac" etc.
View Replies View RelatedI wrote a code that allow to open a Word document, and save it. Before it worked perfectly... but after changing the Server, it doesn't work anymore! Code:
View Replies View RelatedI have a pdf or word file on my server and i would like put a link or a button on my website to print it. So when i push the button the file should be printed.
The confirmation popup window i sno problem. So i am looking for something like window.print,but then to print a word or pdf file that i have somewhere on my server . Is this possible?
I want to open word file in explorer. I am using hyperlink for this purpose but it doesnt show me the file opened. Though i able to do save as on it.
View Replies View RelatedI have an ASP page which needs to export some HTML content and images into a Word file.
Currently I am displaying the image in the Word file from the URL.
What I need is to stream the image into the word file alongwith the other HTML contents.
How can open a Microsoft Word file by ASP?
View Replies View RelatedJust a thought...Using
Code:
Response.ContentType = "application/msword"
to save asp pages to MS Word, saves the text on the pages OK, but, pictures, icons etc are just saved as a link to the original picture file . If the picture/image is not on the current PC opening the WORD file, then none is shown..
I was wondering if I could save the asp pages WITH images/pictures & icons using MS WORD on the server and then the users downloading the .doc file from the server to their PC, would this embed the pictures etc in the .doc file, so it could be shown on any PC. (which has WORD or a WORD Viewer installed).
If this is possible could someone point me in the direction as to how to get started opening WORD on the server and saving the .doc file on the server.
generate an ms word file for an asp output?
<%
x=date
response.write(x)
%>
- is it possible for the date (code above) to be displayed on ms word?
I have a document saved to a public network server. The public directory grants change access to all users on the network. To keep my Word doc protected I am using the Security feature "File Sharing Options" in Word to attach a password to the document. This works as expected when users open the file with Windows Explorer.
I also have an ASP web page that has a link to my file on the public drive. When I click this link, the Word document loads without asking me for a password and is not read-only. (Note the link in formatted with an href attribute like this: file://servername/share/filename.doc)
Am I mssing something? Shouldn't the Word security work even if the file is accessed through a hyperlink?
when a student logs in i want to create a Microsoft word (doc) file with basic information filled from database and rest of the info will be hand filled. how to get data from sql server and fill the .doc file with it.
View Replies View RelatedI have a strSQL line.. that basically does a SELECT * from many joined tables. The output is displayed into a table. What I'd like to do is, to have each table's field entries (say a Name field) displayed as a URL.
Clicking this URL will spawn an external viewer, which will open a predefined MS Word template. ASP code should then do a few SELECT statements, parse them, and write them to certain areas of the MS-Word document.
Practically, a user should be able to click on a name, and have MS-Word launch, filling in details on the Word document, such as Name, Address, ZipCode and so on, which are stored in SQL-Server 2k. how I can get this to work?
How can i convert the .fxm(fax) file format to any of editable file formats such as Microsoft word or excel.
View Replies View RelatedI want to open word file (or Excel) from IIS server (URL) without
getting security window for input Username and password. I know
Username, Password and Domain. I'm trying to open with:
http://domain%5cUsername:password@URL
When my computer is registred in this domain - no problem. But if my
computer is not from this domain I always get window for input
Username, Password and Domain.
I have prepared a mail merge application in VB. Now i want the same to convert to ASP. how to go about it. I mean what class need to be used for that.
View Replies View RelatedHow would this be done for something like a text editor?
For example, say I wanted to launch a text editor from a hyperlink AND also the file I wanted to open with the editor as as well?
I have gotta a page in which a user can upload his profile (saved in word format). Is there any way that this profile can be stored into the database and not in the web directory. I tried using Scripting.Dictionary.
View Replies View RelatedWe down load a text batch every day from the site to the local computer so we can run it through the carriers program to create the labels for items. I want to speed this up as much as possible thus once the item is downloaded a user should open up a page and it should detect the newest file and then begin to edit this.
(Finds | and splits down by product so I can do type of posting and if 2 items need 1 label then don;t waste or if going royal mail instead put into another database!)
So basically - can I select newest file from folder as there is no easy pattern name wise. In terms of the name the batch number goes up once per day and so it xyz99.txt so I would need to find 99.txt etc...