|
Hi, I have a table with NO row index.
But I need to loop through all rows in the table and retrieve the "first_name" (second column) one at a time from WITHIN A STORED PROCEDURE (so, not asking about ADO and stuff here.)
So, roughly, the pseudo code will look like this:
DECLARE my_cursor CURSOR
... then what...
WHILE !my_cursor.EOF
fname=my_cursor("first_name")
FETCH NEXT my_curosr
END WHILE
Can someone translate this into SQL statement please?
norm
|
|
|
|
|
Got it, here's the code:
DECLARE @login CHAR(15)
DECLARE temp_cursor CURSOR FOR SELECT login FROM passwords
OPEN temp_cursor
FETCH NEXT FROM temp_cursor INTO @login
WHILE @@FETCH_STATUS <> -1
BEGIN
PRINT '@login: ' + @login
FETCH NEXT FROM temp_cursor INTO @login
END
CLOSE temp_cursor
DEALLOCATE temp_cursor
norm
|
|
|
|
|
Problem. I've run into problem declaring my cursor: table name is dynamic (@temp_table_name). Help! Code as follows:
DECLARE temp_cursor CURSOR FOR SELECT strToken FROM @temp_table_name
OPEN temp_cursor
FETCH NEXT FROM temp_cursor INTO @token
WHILE @@FETCH_STATUS <> -1
BEGIN
PRINT 'CURSOR TOKEN: ' + @token
FETCH NEXT FROM temp_cursor INTO @token
END
CLOSE temp_cursor
DEALLOCATE temp_cursor
norm
|
|
|
|
|
norm,
From what I can tell, you really do not need a cursor. Will the following work? I am assuming you are using SQL Server, if not, what database?
SELECT @login = login FROM passwords
This sets the @login variable = login fom the table. The risk you run is if your query returns more than one value.
Let me know if this doesn't solve your problem.
Jeremy Oldham
|
|
|
|
|
yes, it's SQL server. And yes, the number of rows in the table is NOT KNOWN apriori.
So, I do need a cursor because there's no rowindex for me to specify a WHERE clause.
norm
|
|
|
|
|
norm,
Can you give me an overall view of exactly what you are trying to accomplish? I could help you out with the cursor syntax, but in SQL Server, anything you can do with a cursor, you can usually do with a correctly written SQL Query.
Jeremy Oldham
|
|
|
|
|
I have a page that displays report data in a table. The report records each have a link that allows the addition/edit of one of the report's fields by opening up a new window.
window.open("EditComments.asp?" + urlData,"editWindow","width=700,height=250, resizable");
In the new window the user edits the field and presses submit. The edit is updated in the SQL Server database but my question is how can I refresh the original report page (that is still open) to show the updated field.
OhioSkip
|
|
|
|
|
ohioskip wrote:
but my question is how can I refresh the original report page (that is still open) to show the updated field.
Using Javascript and the very handy Opener reference.
Here is some sample code:
window.opener.reload();
That will reload the window that opened the current window, so put the code in the pop-up window. Opener is very useful and can be used for all sorts. You can even fire off functions in the parent window.
Paul Watson Bluegrass Cape Town, South Africa
Anna-Jayne Metcalfe wrote:
I don't know much about Artificial Intelligence, but I've seen a lot of Natural Stupidity in the corporate world...
|
|
|
|
|
hello
i want to save some information, that written in edit box, in a text file, how can i do this by javascript.
thank you
Best Regards
|
|
|
|
|
This is probably not the answer you are looking for, but, hey you didn't specify whether it had to be a client-side solution or not.
You can use server-side (ASP) JScript.
<% @ LANGUAGE = JScript %>
Essentially there question is, "Where is the text file that you want to save the information to?" My guess is that it is going to be on your server and not the client's machine. I mention saving to a clients machine because I believe it is possible with a combination of client-side JavaScript, ActiveX and having very loose security/permissions set on the clients machine.
But, like I said, this is probably not the case. In order to save information to a file back on the server there must be something that performs this action on the server. There are many different ways to approach this ... please write back if you have further questions.
Wally Atkins Newport News, VA, USA
|
|
|
|
|
hello Mr. Wally
thank you very match, yes you are alright , i want to keep some information on my server, i don't know if there is any method to deal with a text file which in my server for storing data.
|
|
|
|
|
Just out of curiosity:
What kind of server do you have?
OS?
Wally Atkins Newport News, VA, USA
|
|
|
|
|
Web gurus, this ought to be an easy one. Just looking for basic strategies here, but currently beyond my experience realm.
I have a grandson now, almost 11 months old, and have been taking the requisite zillion pictures of him. Since family and friends are spread out all over the globe, the easy solution was to put together a web page with selected pictures and descriptions so everyone could see. So far, it's a big hit.
The problem, of course, is updating the the thing, which is becoming harder and harder, not only in selecting which pictures to make available, but also in updating the HTML page itself. I currently have a 56K dial-up to my ISP, and 10MB of space, which is plenty for the 30 or so pictures I have up there. I would like to be able to add just a few pictures every couple of weeks, or every month or so.
So what I am looking for is the strategy for making this easier. Once I decide on a few good photos, I shrink them down to make thumbnails for the HTML page. Clicking on the thumbnail will display the full-size photo. Right now, I have to go and edit the HTML page by hand and then upload all the new stuff to the ISP. The HTML doesn't change very much as the structure and layout are fairly static. It's really only the filenames and descriptions that are changing, but I have to edit everything by hand. Not too difficult, but time consuming.
I guess I am thinking about an XML file with the name of the photo, the thumbnail, a description, etc, and then the HTML is generated automatically? I type in some basic info into a file, upload file and photos to the ISP, and the new page is updated automatically? What is the best way of keeping the maintenance of this project to a minimum. Right now, the updates are becoming few and far between, because it just takes too long to update everything by hand. There has to be a better way.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Dave, just make yur grandson do it!!! sheeeeesh !
|
|
|
|
|
Yeah, but he still drools quite a bit and that makes the keyboard sticky.
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi Dave,
Take a look at this program: Gallery[^]
It's a (mostly) PHP program that uses a MySQL database to organize the backend information. I don't know if your hosting setup will allow for it, but this program is very slick.
Failing that, Photoshop allows you to select a batch of photos and export thumbnails and all of the HTML needed to create a static gallery. I don't know if you can add descriptions (I suspect you would have to do this manually), but this is also a very convenient option for quickly creating galleries.
Good luck,
Jon Sagara
Hi! I'm Melanoma, Moley Russell's wart.
-- Uncle Buck
|
|
|
|
|
David Chamberlain wrote:
There has to be a better way.
There is, but I have yet to master it. I have a website for a very busy club, and it really should be updated daily. But there's no time for it! I'm trying to put all the content into a database, then build a set of pages for updating just the database. The HTML won't change - the structure will be static, but the paragraphs and pictures will be easier to edit. Plus, I could then farm out the updating to other members, each to his/her own activity and no knowledge of HTML required, and not deal with it at all. Look into ASP and ADO for handling your pictures; I think it would work well for you.
It is ok for women not to like sports, so long as they nod in the right places and bring beers at the right times.
Paul Watson, on Sports - 2/10/2003
|
|
|
|
|
You could set up an XML file containing the picture information:
<Photos>
<Photo desc='This is a picture' thumb_path='/path/to/thunbnail1.jpg' full_path='/path/to/fullsize1.jpg' />
<Photo .../>
</Photos>
Then have an XSL or client-side script that represents the static parts of the page and renders the HTML with the contents of the XML file that you upload.
Hope that helps...
-pete
|
|
|
|
|
Hi All,
I'm new to web development and I'm in the process of creating a website to display information that is coming from an xcel spreadsheet. Is there a way that I can have the pages automatically update their tables from the spread sheet, so all i have to do is update the word spreadsheet and upload it to the website server?
What are some really good basic references that I can latch onto for Web Development too ???
Thank you in advance.
Dan Willis
|
|
|
|
|
Hi, I need some help in javascript.
Think that we have got a function to produce new objects like this:
function Obj(id)<br />
{<br />
this.id = id;<br />
this.showId = show_id; <br />
}<br />
<br />
function show_id()<br />
{<br />
alert(this.id)<br />
}<br />
and when onload event occurs I create a new Obj:
<br />
window.onload()<br />
{<br />
my_obj = new Obj("A45d");<br />
}<br />
Up to this point every think goes well. And now I want to and a div in the page and want to attach an onclick event to this div to call myobj.show_id() . But I can not find any way to do this. I try attachEvent function but it only gives result when the function is standalone.
Please help me, that it can be done in some way or not
thanx.
karanba
|
|
|
|
|
Yeah, you can't attach to a method of a specific instance.
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
Is it possible to use C# documentation engine (NDOC) on javascript functions ?
Jonathan de Halleux.
|
|
|
|
|
No, I'm not giving it away... or even begging for it (unless you are feeling particularly generous this morning)
Seriously, we have a statement display page for our members. This includes any commission they may have made, payments to us, payments to them, etc - usual statement stuff. In SQL Server we use the money data type, which has 4 decimal places, which are essential for commission by percentage. In ASP we display this using formatnumber 2 to show pence.
Now in reality this is not a problem - after rounding up, they might see 1 penny to much, but SQL will still transfer the correct amount to their bank account upon request. However, for our FD, who inputs figures into Sage from this statement, it is rather more of a problem. I wonder how many extra pennies will be floating around by the time the auditors come.
Now we are brainstorming and trying various options for this, but I was wondering. For those of you will financial experience - what do you do?
Thanks
Throw in a bit of S&M or eye-ball sucking-Paul Watson on the merits of swearing, sex and obscenities in CP posts
...they assumed that reasonably intelligent adults would know enough to leave the building if it was burning. Those who did not were, presumably, expendable, and there was less paperwork involved than trying to fire them-Roger Wright on fire drills at work
|
|
|
|
|
How about a seperate report for the FD which shows 4 DP?
Or, just ODBC into Sage and enter the figures yourself.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Richard Deeming wrote:
How about a seperate report for the FD which shows 4 DP?
It seems that using numeric(9,2) rounds it better. The other options you mentioned are also under consideration.
However, I was wondering how people like banks do it. They round our statements to 2 dec places, and yet they aren't usually out by a penny if you add them up (never in my experience anyway)
Throw in a bit of S&M or eye-ball sucking-Paul Watson on the merits of swearing, sex and obscenities in CP posts
...they assumed that reasonably intelligent adults would know enough to leave the building if it was burning. Those who did not were, presumably, expendable, and there was less paperwork involved than trying to fire them-Roger Wright on fire drills at work
|
|
|
|
|