Problem With Adding Records To A Table
There is something wrong with the adding code. It will add sometimes. It's a large database where I have to add records to multiple tables.
The products table doesn't work correctly. Maybe there's a typo somewhere that I don't notice. Please look at the bolded part of my code and see if you can catch something. Code:
View Replies
ADVERTISEMENT
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".
View Replies
View Related
I have aproblem to transfer a data from table x to table y based on id. Its mean when 2 table have same id all data table x must move to table y. I don't know which command need to use is it insert into or update?
<%
Dim conn
Dim rs
Dim MYSQL,MYSQL2
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Set cmd = Server.CreateObject("ADODB.Recordset")
conn.ConnectionString = "DSN=prmm;UID=administrator;pwd=sa"
conn.Open
startdate=request("tarikh1")
enddate=request("tarikh2")
MYSQL = "SELECT * FROM table_x where paymentdate between '" & tarikh1 & "' and '" & tarikh2 & "'"
rs.open MYSQL,conn ....
View Replies
View Related
I have a table with 2 fields, name and value
I need to be able to add multiple records quickly, for example I need to add
name value
abc 1
abc 2
abc 3
abc 4
abc 5
abc 6
etc etc, does each record have to be added separately, or is there a way I
can add a chosen number of records, lets say 10, and have the value field
increase by one each time?
sometimes I might have 30+ simple records that need adding quickly, and each
time the first records value will be one, and each record after will
increase by one, is there a way to solve this problem or does each record
have to be added separately?
View Replies
View Related
I have a drop down which has numbers from 1 to 25
When a user selects 3 he will see 3 first name textboxes and 3 last name textboxes
the user fills them out and hits the submit button
three records are added to the table
i have a for loop for adding records
Here is my code:
View Replies
View Related
Just when you think something is working, suddenly something new comes along.this is my situation: I want to add intQuantity of all records that have the same prodID. I have tried all sort of variations but I don't seem to get it. I would imagine that it must be simple, that's why I can't get it.
SELECT SUM ( intQuantity) AS ItemTotal
FROM tblOrders
WHERE prodID = ? no clue
Or can I do that in ASP? doing something like (my example doen't work)
<%= (rsOrders("intQuantity") + rsOrders("intQuantity")) %>
in the mean time I'll be looking around for an answer to my lack of know how.
View Replies
View Related
I have a database which contains 2 tables. One which contains standard information (which every record has) and then the other, which is a relational table and is just a long list of records with different attributes that apply to various id numbers found in the first table. Both tables are contain records with the same ID number.
Now, I have an ASP file that accesses the MDB file and displays it in XML format. I have it working for only the first table. However, I was wondering how I would go about getting entries from the second table entered.
So it would display the items from the first table on 1 line - and then add on anything from the 2nd table that applies to that ID - all on one line. Code:
View Replies
View Related
Is it better to use the Recordset methods or make an SQL query string and use conn.Execute() if I want to add to a table? I figure the first might be safer, but it seems weird to someone who learnt on PHP... I'm using SQL Server if that matters.
View Replies
View Related
I have loop displaying certain records depending on an id number in my sql database. What i need to do using asp is total all the numbers in one of the fields and display that as a response.write.
View Replies
View Related
I may have made a typo somewhere. I am trying to delete collections from RelProdCollection Table that has a certain record with Product ID number of __ and then readd them based on the user's choices on the edit form. Code:
View Replies
View Related
I want to add intQuantity of all records that have the same prodID. I have tried all sort of variations but I don't seem to get it. I would imagine that it must be simple, that's why I can't get it.
SELECT SUM ( intQuantity) AS ItemTotal
FROM tblOrders
WHERE prodID = ? no clue
Or can I do that in ASP? doing something like (my example doen't work)
<%= (rsOrders("intQuantity") + rsOrders("intQuantity")) %>
in the mean time I'll be looking around for an answer to my lack of know how.
View Replies
View Related
I have a data base that I wish to add a record to. I have many fields to ender, but I was testing my code with just one and it works just fine : Code:
View Replies
View Related
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 Related
SQL 2000 database with ASP
I've found many things "out there" regarding updating and deleting
multiple records with checkboxes but I can't seem to find anything
about adding them. A user wants to create a price list for their
client and they need to add parts to it in a separate table. I would
like to display the list of parts and the user would select multiple
parts to add to a price list by checking a checkbox and submitting the
form. Code:
View Replies
View Related
i have an instance where I need to add records to 2 different tables. i know how to do it basically, but the problem is, one table is generating a key number and i need this number for the second table records.
how do i put the appropriate records into the first table, grab the id number and insert the records into the second number? the information is coming from a form. i'm developing in an access db but will be moving this to an ms sql db before it goes live.is there a stored procedure that might make this easier? i know nothing about stored procedures.
View Replies
View Related
Can I do the following things in the global.asa file?
When sessions starts:
Add a record into my database
When session ends:
delete it where rs("sessionid") = Session.SessionID...
?
I'm pretty sure I can, but...I've heard not ALL things can be done in global.asa...
Do I create an object, and a connection? How would I do it? Since I want a database in MY database, not in memory like I've seen...
View Replies
View Related
I have an array which I want to save into a database table I tried a few things but it doesn't work. This is as far as I got: Code:
View Replies
View Related
I want to add a row to library table. Table has total 7 fields. But I
want to create the new row with 5 field data. When I run the following query
in MS Access
strQ = "INSERT into library (index,title,author,itemtype,createdate) VALUES
('B-096','Hihihihihi','hello','Book','07/18/04')"
It successfully adds the row. But same thing I am trying with the following
ASP code. It gives error, saying syntax error in INSERT into statement. Code:
View Replies
View Related
I got an asp page that supposed to add,delete records from access 2000 mdb file. It loads all the records but when i try to delete or update i get these errrors. Code:
View Replies
View Related
I have a form that uses Code:
<select name=player_id multiple>
<option player_id="<%=player_id%>"><%=FName%> <%=LName%></option>
</select>
To create a drop down selection list. What I want to send to a table is FName and LName instead of the ID. Any hints on how to do this.
View Replies
View Related
With ASP, how can I automatically add records to a database with an excel file residing on the user's machine? Assuming the excel file has the same field names/datatypes/order as my database table's fields.
View Replies
View Related
I'm trying to display records from a table in a sql database.The problem is, every month a new table is created, so I don't know what the name of that table is going to be.
It there a way that I can make sure the sql only reads from the latest created table?
View Replies
View Related
I've created a form where the user should be able to select an option, then a second list will be populated based on that selection. The next part is where I am running into trouble.
The user can also select a time window which can limit their search, if they so choose. Code:
View Replies
View Related
I know I've asked this before, and other people have too. But when I use that igrep search thing, almost all of the search results are scambled (when you clikc on a search result, its just a scambled up thread).So I'll ask again, because I have forgotten. I know that to count the entries in a recordset, you usethe following code...Code:
RS.RecordCount
But I know that you need something else, something about a client-side pointer? Without it Im just receiving -1 each time.
View Replies
View Related
Say i have 100 rows in a table and i make a query:"Select * from table", i will get all the 100 rows displayed, but what i want to do is to display 20rows in a page and then have 'Next' and 'Previous' links to navigate through the records 20 by 20. This is in fact exactly as in this forum where only 20 posts are displayed sorted by most recent ones and so on.
View Replies
View Related
I have this sql query
SQL="SELECT title,body FROM cinema WHERE date_end > #" &date()& "#"
cinema is a table which contains announcements about cinema title,body (txt fields)are columns of my a table called cinema date_end(DATE/Time Field): is a date (DD/MM/YYYY, short format).This date shows when the announcements expire .But SQL returns all the announcements that the table contains even those that have already expired. Why??I cant find any mistake.
View Replies
View Related
Trying to duplicate the functionality found on this page:
I have a new table i've created that stores peoples search queries:
INDEX, SEARCH, COOKIEID, CID, SUCCESS, DATE
I have a seperate table that stores my product data, including the keywords. My search function uses a LIKE %%examplekeyword to match searchs to the DESCRIP column in this inventory table.
How can I make one SQL query to display the same results as on the the example page? It's easy enough to SELECT the results, but how do I do a count of how many instances of that search word exist, inside the same SQL statement?
View Replies
View Related
i need to go through a list of items and check to see if items on list 1 are on list 2 and vise-versa. so im going to look at item 1 on list 1, and go through all the items on list 2. if i find a match, ill update the record on list 1, if i dont find a match ill update the record on list 2.
im going to need a nested loop. in c++ i know how i could do this, but im not sure as how to do it in vbs/asp. can you do for each "record" in "myrecordset"? or do i have to get the number of records in the table and run the loop that many times? which would be eaister?
View Replies
View Related
I am using a db to hold student data records. I currently display them in a roster based on their affiliation with a certain class. To edit a record I need to click the name of an individual, it opens an edit page, I make the changes, hit submit and return to the roster.
This is pretty standard stuff. What I would like to do is change one field of every record without opening each record individually. The idea comes from my Fantasy Fball league roster:
McNabb, Donovan QB PHI ActiveReserve
Droughns, Reuben RB DEN ActiveReserve
Johnson, Rudi RB CIN PIT ActiveReserve
...etc...
Where the example above says "ActiveReserve" is a pull down menu that lets me change who is playing week to week. I can then change each record, hit submit one time, and update the db. So how do they do it?
View Replies
View Related
I am new to ASP and I want to use a query which links one record in a table to another record in the same table to display a list of values. The query lists the names of all managers (the managers staff no is held in the reports_to field of an employee)
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT DISTINCT p2.Surname + ', ' + p2.[First name] AS Expr1
FROM People p1 INNER JOIN People p2 ON p1.reports_to = p2.[Staff no] WHERE (p1.[Staff no] IS NOT NULL)",con,3,3
while not rs.EOF
%>
<option value="<%=rs("p2.surname")%></option>
<%
rs.MoveNext
wend
rs.Close
However it doesn't like the alias (p2). Is it possible to return a list from this type of query?
View Replies
View Related
Does anyone know how to insert multiple records in the same table at the same time. This is what I have. I have a form with 6 fields and they are name prod1 through to prod 6. The table is called related products.
Basically this table is related to the main table called prod_parent. tried looking on google and couldn't find anything.
View Replies
View Related
I already have this piece of code that inserts multiple rows of data into a single table at once. Code:
View Replies
View Related
how can i Count and display number of records in table?
View Replies
View Related