Save Db Records Of A Field In An Array
I want to save db records of dates in an array something like the below(I know it's wrong, i'm just trying to describe what I want)... Code:
View RepliesI want to save db records of dates in an array something like the below(I know it's wrong, i'm just trying to describe what I want)... Code:
View RepliesI've built myself a shopping cart which saves an array as a session variable and this works fine.
However I would like the content of cart not to be lost even if the user leaves the
website. Is there a way to save the array to a cookie or can this only be achieved by saving the cart to the database?
From my system, it allow product has multi-category, so I need to save
all category names which one product belong to into one field on a
database,
and record saved like " nameA|nameB|nameC " - seperate by "|".
question 1:
the second time when i update the record for same product name, how to
have a record
like "nameA|nameB"
After multi-category name saved, then, i would like to generate a
navigate name with the link like
home > nameB > name of product
question2:
so how can i retrieved only one name from category field.
is it possible to read the content of a db[ms sql] field and save the content as a file[e.g: .bmp]
View Replies View RelatedI have read 10000 opinions on returning random records and I am more
confused now that before I started. I have a small access db that will
contain 20 or so rows with 3 or 4 columns. I like to return a set of 6
distinct rows and display the columns in html. I have seen response.write
and loops but can't I throw the 6 random rows in a array and pull the data
as I need it in the page? Examples?
I have a shoppingcart which is saved in an array. When the user goes to the checkout and and presses the order button the contents of the array gets saved in a databasetable. This all works fine.
The problem that I have is that I want the articles that the user ordered get subtracted from the Quantity I have got in my database. But I don't know how to tell the database which records have to be updated. Code:
does ASP have arrays, and if so, can I use an array, inside a loop, to do the following.
x=field name *the field is now comma separated values*
while x != rs.EOF
take each part of x , put into array.
filter recordsetABC with current part of X.
display filtered recordset on screen.
next x
My syntax is horrible, so ignore that, this is just a theory exercise right now.
My products table has a weight field that I need to populate. A bunch of them have it and a bunch of them don't, but I need them all to have one. The weight is the same, 3, for all the records. I also have an Include field in that table. I want to make the weight field 3 for all records where the include field is true (it's a yes/no checkbox in access.)
I'm using Dreamweaver and I can build the SQL statement just fine but I'm not sure of how to loop through this to set the field for each of these records.
I've got a table with three fields:
ref (Autonumber)
notice (memo)
expdt (Date)
I'm trying to use an SQL statement to delete all records where expdt < the current date (Now). Here is the code I'm using:
<%
If Request.Querystring("act") = "clean" Then
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open ConnStr
strExpdt = cdate(Now())
sql = "DELETE FROM tblNboard WHERE expdt < " & Now()
conn.Execute sql
conn.close
set conn = nothing
strResponse = "All expired notices have successfully been deleted."
End If
%>
However, this just gives me the following error:
Syntax error (missing operator) in query expression 'expdt < 11/12/2003 19:54:25'.
What am I doing wrong??
I'm writing a database admin page in ASP. I had it adding records correctly. Then I added an autonumber field ("ID") to the table, and it stopped working. The sql I'm using is Code:
View Replies View RelatedI know it should be very easy but I am new in ASP so I could not figured out.
Here is the simplified version of my code:
thePaymentID= request.querystring("IDValue")
SQLqueryPayment= "SELECT sum(paid) as paid, sum(Interest) as interest
FROM payment WHERE payment_ID =" & thePaymentID & ""
dim rstempPayment
set conntemp=server.createobject("adodb.connection")
conntemp.Open "DSN=payment"
set rstempPayment=conntemp.execute(SQLqueryPayment)
fldValPaid = rstempOwner.Fields("paid").Value
------------------------------------------------------------------------
I need to find out if "fldValPaid" hold anything. I will use it an IF ELSE statement. In payment table a particular record could exist or not. How do I find out by evaluating "fldValPaid" if any record exists or not. I have to find out using "fldValPaid" ...I can not use number of record/record return or any other method.
how to update a database from a dynamic table with checkbox. Their is only one field I would like to change and that is the one with the checkbox.
I am using Dreamweaver and I create a dynamic table, add the update record and I get BOF EOF error. The database does have data in it. Code:
How does one return records in a recordset based on a time/date field. If todays date is 8/25/04, how could i return all those records from 8/25/04. Mind you, i have long date format ex. "8/25/2004 4:46:45 pm"
I dont want to user a form for this i simply just want these time- sensative records to be returned in the recordset .
The problem concerns 2 tables, cart_products and cart_shoppingcart.
Cart_products contains all the product data (eg, prices, product's key name, etc), but most importantly, it contains the quantity of stock (prod_quantity) for each item.
cart_shoppingcart contains all of the user's items in their shoppingcart, including those that are part of an (customer) order; these have the order_number to differentiate from those that aren't in any order (their Order_number is 'no_order', the others have the order number).
Now, what I want to do is this:
For every item in the order (ie, every entry in cart_shoppingcart that matches the username and order number), take the quantity (x) the customer is ordering, then take the quantity of stock remaining (y), then subtract x from y to create the new stock level (z) and update the appropriate record in cart_products with z (all this with SQl preferably).
I was thinking of using a Do while loop, but realised that it wouldn't work as I'd have to use several SQL statements and then I'd run into a problem the minute ASP reads "objrec.movenext".
I dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
I'm trying to pull the last 5 records from my database.
<% j=5
rs.MoveLast
While ((j>0) AND (NOT rs_article.BOF))%>
''Execute HTML and data insertion here
<%rs_article.MovePrevious
j=j-1
Wend%>
Everytime I attempt to run this code, I recieve an HTTP 500- Internal Server Error. It tells me no more than that. I know that my connection settings are OK because when I move forward through the database (first five records), the code executes without error. And yes, my Cursor type is Dynamic.
Alternatively, I would also like to know how to add new recordset to the beginning of a database rather than the end.
I am using a Relational database for my site and i have the following tables:
FIXTURES, GAMEDATES
the fields in FIXTURES are:
GameDate
Home
Away
(All of the above are numerical fields)
the fields in GAMEDATES are:
DateID(integer)
GameDate(#Date Field#)
What i have done is in the GAMEDATE field in the FIXTURES table i have used the ID number of the date that i wish to assign to that record - using a LEFT JOIN to display the actual date that is pulled from the GAMEDATES table (That which corresponds to the relevant id used in Fixtures)
The problem is that in some of my code i want to display records using sql and sometimes in the where clause i use the following:
WHERE Fixtures.GameDate<=(Date())
obviously meaning WHERE GAMEDATE is LESS THAN or EQUAL to TODAY.
The thing is when i use the join it does not use the where clause and displays all of the records in the FIXTURES table.
Does any one know how to get around this, i have not received any error messages it just isnt displaying the right data
Im comparing values in a field while doing a loop if sAct<>myData(5,i) then At the end of the loop I make the value of sAct equal the current myData
This will work when comparing other fields withing my recordset (so I know the statement works) but it will not work for the field I want to compare. The only difference with this field is that it has null values. Could this be the problem? if so, how do I deal with nulls?
I have an Access database with two fields that I would like to group by. The two fields are location and department. Field names are "Location" and "DeptName".
I have the code correct for grouping by location. That code looks like this: Code:
I want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.
I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?
I have a input form with 5 fields. One of the fields is MajorNo and the other is named Description.
I have a reference table in my MS Access database (tblMajor)that lists the major numbers and their descriptions.
I would like to have the description field in my ASP automatically filled based on the major number entered on the form, so the user will only need to input the major number when submitting to the Access table (tblSalesTotal).
I would like to have an option for my end users to do a SAVE AS. Is there a way to do this? I have a excel spreadsheet which is being created by asp and at the end of the page I would like to have an option to do a save as. so they can name the file and put the file anywhere they want.
View Replies View RelatedWorking with an asp page which pages through dates. If the
user saves one page as a mht file and pages to the next
day and saves the second page as a mht file, both files
turn out to be the same. It's as if I.E. 6 saves the
cached information, however if you open a new window and
save the page from that window it saves properly and the
cached information is available for the second window so I
think I'm on the wrong track.
i need to force a download to open save as dialog box rather than opening the doc in a browser.
View Replies View RelatedIs it possible to have line feeds/breaks automatically entered when the text wraps to a new line? I am using a <textarea> input on a form and using the <pre> tag when displaying the text to a html page (embedded in a .asp page). The text is being saved to a sql database. Returns seem to be displayed. But the wrapped text just displays as one long line.
View Replies View Relatedbeside save as htm and txt in IE , can i save as jpeg or other formats ?
View Replies View Relatedcan any one giv me some link or any helping material , how i can can pic in acces or sql database regarding by user ....
View Replies View RelatedI need to save a lot of pages to a .doc MS Word file with one button click on my asp app.... can this be done ?.....I am thinking this .doc file will be saved on the server, so I can then download it to the users PC.
I can have the MS Word templates to fill out on the server , so do i create an asp page to fill out these templates and then save the file..then somehow download it automatically, hence it will end up on the users PC in a shared Dir...is this all possible?
I would like to save a web page to a file. When I do that, sometimes
the saved web page does not look like the original web page.
For example, when I save www.msn.com, it looks very different the
original page.
How can I save the web page to look like the original (as if I do
"File" - "Save As" and under "Save as Type" select "Web Page, complete
(*.htm,*.html)" ?
This is how I save the web page:
Set fs = CreateObject("Scripting.FileSystemObject")
Set filePtr = fs.CreateTextFile("c:abc.htm", True)
filePtr.WriteLine (WebBrowser1.Document.body.innerHTML)
whats happening is i do a form post from a form "A", to a form "B" where
it does some processing and then does a form.redirect to form "C"..where
there is a link to the form "A". I only want that when the user selects
form "A" from form "C" then at least i should be able to display his
name and email address what he had entered previously.
what the best way to save the variables and when i display back in the
form how do know whether hte form is coming back or not?
is there a avaialble code in asp.net...
that have a similar function to Save as Dialog
i want to save asp created records to excel sheet by clicking a link.
link should be in same asp created page .By clicking link ,the populated asp records to be saved like save as option..At the same time i want to see asp records in html format .By clicking the link.