How To Transfer Records From One Table Of A Database To Another Table In Another Data
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
I have a table produced with names across the top and services down the left hand side with boxes for numbers for people who recieve services then the info is written into a table in an access db. That works fine and here is that code:
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'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?
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:
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.
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.
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.
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?
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?
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:
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:
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?
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?
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.
I'm trying to display records from an MS Access DB (*.mdb) in an ASP page (table).. I don't want to display all the records though, I just want to display the total of these records..i.e in my table I would like to show how many calls someone has closed this year..(number)
Joe Bloggs ---> 100 Closed
Is this possible? I was thinking that I need to write an ADO that includes COUNT but I'm not too sure how to write this.. Here's what I have so far: Code:
I need some ideas in this if you can please help me.The folllowing is the scenerio:
I have a form which is the normal html with some validations and scripting done in javascript and i have a text box by name ticket no when the user enters a ticket no which exists in my database I need to update all my other form textboxes and textboxes with the data in the database else I need to show a alert that this doent exist in the database.
usually the event handling is done in javascript but now i have to call server side connection I have no clue how to do this.
How do i add data from table to cookie? I mean, I have an excel style table at website that is read from database via query, and what I want to do is add information, that is at the same line with the "apply" button, to a cookie for further use?
i used sql code above to display data in a table. basically, the flow is like this. when there is a new reservation, a staff will be assigned to handle that reservation from the beginning until the end. before this, i just display a staffCode that retrieved from Reservation table.
then, i made changes to display staffName and removed staffCode from the table (based on requirement). but, because previously, there are some reservations that have been assigned to staff, i do not have any problem to view all data in the table.
but, when i click other reservations that have not assigned to any staff, an error page came out. the default value for staffCode in the Reservation table is null. because this null value, i've got an error page. is there any steps i can use to solve it?
Right i got the login page working, on my main page i have a big table in the middle with a few small tables either side of it, one of the smaller tables has a form where you can search a database, is it possible to have the results of the search appear in the main table? and is it difficult?
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.
I have coded a form which enters data into a access table however I want the same recordset when clicked to go to another table in the same database then when clicked again to go to another table within that database...is this possible?
If i created three different type of table. Inside these tables, they might have the same key field's name. Example:
Table A - ExecNo, Month, Year, CustCode Table B - ExecNo, Month Year, DestCode
as u can see that these two tables have almost the same key field but they r actually keeping different data. how can i list these different data out in an asp page? it is because i am having the problem whereby.
where the table want to display data from table B, it actually misplace by table A . how can i write the sql function to differentiate both of them.
I have a table that's holding 'open data' until it needs to be moved to another table where it is then 'closed'. I think I have my SQL statement correct to do this, but I keep getting the error below.
Quote: Originally Posted by Error Message [Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.
I have verified that I have the same number of fields in each table, but I think the problem is both tables have an Autonumber field and obviously you cannot move one autonumber field overtop another one. What is the easist way to exclude my autonumber field from being inserted into my other table without having to call every single field by name in the SQL statement? Code: