Adding SQL Server Transactional Queries To An Old ASP App
I wrote an app several years ago that has only just begun intermittently failing on a particular stage in a series of sql queries. When I wrote it I wasn't familiar with transactions and so didn't bother implimenting them.
Since then I've moved from ASP to PHP and have done several applications that used the ADOdb library's transactional features. Now going back to ASP I'm having a hard time finding any information on how to actually impliment a transaction from an ASP page for a set of queries that are not part of any stored procedures.
For instance, how am I to know when an error occurs and that I need to roll back? Do I need to set OnErrorGoTo = 0, then check for an error at the end of the sequence and roll back if one occurred?
If anyone could post a small example of ASP code that includes a few queries executed with an adodb connection object, wrapped in a SQL transaction, that would be most beneficial.
i am having trouble getting CDOSYS to work, i have just changed from CDONTS (which was working fine), because i want to be able to email a webpage as my body Code:
Normally I use Access database with ASP, and I create queries using the wizard which Access has. Then, I copy and paste the code in the ASP page and create my SQL.
I was wondering if it is easier to call the query directly with its name from Access, or else continue using the old procedure.
I'm trying to build sql queries that will search through my DB. I am currently seperating my queries through multiple indexes in an array depending on whether or not the strings are wrapped in quotations.
I also want Fluffy Teddy Bear (three different LIKE statements)
Say I have 5 fields in a form. I have figured out how to query a database using all 5 fields and display the records that match at least one of the fields.
I'm trying to figure out a way to, if say the user only fills in two fields, to only search the database for matching records based on just the two fields. As I have it now, the database is searched for the two fields they entered as well as three fields of "", which I would rather not have. Is this possible?
I have a DB. With 1 table called "products" and 3 product records. The 2 fields present in the table are called product_name and product_price. The names of the products are Product1, Product2 and Product3. They cost 13, 8 and 24. Which code (SQL and AP) would generate an output similar to this?
<% SQL = "Select * FROM products" (plus some kind of sum function to calculate the total (to be able to display the sum before the various products) of the recordset without having to loop through the recordset first) %>
I need to connect to 2 different databases in ASP and execute two different queries. Please let me know how to proceed. I understand that ADODB.Command option can connect to only one database at a time.
I never ever thought about this, but recently I made a query in access so I can make a customer mailing list based on relational information and it was so easy to make the query and join tables and assign criterea using access. And I haven't tried or thought about this cause in my own small asp projects I've never used a dbase with queries in it, but after seeing how easy it was, it would save a lot of time from manually writting queries in asp.
So, what I'm asking is if I can use a query from an mdb in asp just like I can access tables?
Can I have one recordset execute a Select and then have another recordset execute a different Select, and then check if a field from the first recordset is different from the field in the 2nd recordset and if so write out that row on my displaying table?
I am using ASP and crystal reports 8.5. I am able to show report from asp. My problem is , I have to show the report based on the sql query that is passed to crystal report from asp. I actually dont know how to pass a query into crystal reports from asp.
I have a single asp page (index.asp) with an include file (include.asp). I would like to query the database with index.asp as well as query it with include.asp.
I searched online, in my "SAMS Teach yourself active server pages 3.0 in 21 days" and it makes no mention of two queries on a single page. Is this even possible?
Is it possible to use an If statement to select a single query from a list of queries from an access db? Something like this:
If Request.Form("Womens") = "Pants" Then 'open the db and run the query called pants ElseIf Request.Form("Womens") = "Shirts" Then 'open the db and run the query called shirts 'on and on we go, etc. End if
My gender categories (women, men, etc.) have multiple sub categories (shirts, shoes, skirts, etc.). Does is make sense to use an if statement(assuming it can be done) in this manner? It seems it would make life easier to use one script to perform many tasks, as opposed to one script that does just one task.
the following statement doesn't work, even thoug when I execute SQL_1 and SQL_2 separetlly it works fine.
SQL_1 = "SELECT COUNT(*) AS ACTIVE_LINKS FROM TABLE_LINK WHERE ACTIVE = 1" SQL_2 = "SELECT COUNT(*) AS UN_LINKS FROM TABLE_LINK WHERE ACTIVE = 0" SQL = SQL_1 & " UNION " & SQL_2 ...
I know that asp can be used to fire off stored procedures within databases, but I was wondering - does a 'query' in Access mean the same thing as stored procedure? If it does, how could I get asp to fire off that procedure when needed?
I need to take two seperate queries and put them in a single html table, but i want to combine the sets of data 'while selecting them' so i can use the SQL sort by command to arrange the whole table by date..
sorting the two queries independantly then dumping them to the table results in both queries being sorted independantly, ie the most recent entry(by date) of the second set of data ends up in th emiddle of the table.. any ideas?
Is there a way of inserting the query of records from the first database into the second? Because I want to use the second db by deleting records that might be unnecessary.
I have a form which accepts the username and password. I am storing it in an Access Database. How do I check if the user already exists in the database by passing SQL queries? Could someone possibly give me the code or maybe a link.
i have a text file (tsv) with products in, but i want to run queries on certain fields, e.g. description, i ahve tried linking the txt file to a databse but the recordset does not work,
does anybody have a sample script that will query a tsv, csv file.. e.g.
I have a form submitting a date range in ASP. I want to use them in a query to select from access.I've done similar things with other languages and/or other DBs.
I currently have a sql query that pulls all records based on a variable(var1) inputed by a user from a form. Each record in my database has a time stamp assoicated with it. I want to give the user the option of pulling all records based on (var1) and allow them to sort based on date or time stamp also with a two fields that will take a range.
(ex. Beginning date and Ending date). So my default sql query will allow for var1 to be inserted and to have all records returned for the current day. BUT, IF A USER HAS ENTERED
A DATE RANGE then all records will be returned for that date range based on the var1's value. How could i go about about structuring my code for this? I was thinking about a "Switch" statement that could response to different user options with different sql queries. What do you guys think?
i have been doing this asp page....but the page doesnt seem to work....it doesnt redirect as i wanted it to be...i dont get any erro message....so idont know wats wrong witht his code:
We have an Access data base with severl tables, queries and forms.We want to put it on the web.Is there a tool that will convert the Access queries and forms to ASP?Sorta like "splitting" the database... but instead of an Access FrontEnd... have an ASP front end?
any way of searching a database without case sensitivity? Make any sense?! I have an Access 2000 db with 11 fields in it: Name, Keywords..., Description... But whenever I try to search through it using the ASp site I made, it'll only find matches if they are written identically, I.E a search for "bob" won't find the entry "Bob".
I thought about making the entire contents of the db Uppercase, but I don't want to, as that would look crap when the contents are displayed in the website.
I am running a dynamic site using MySQL and ASP and wish to back up my MySQL DB on a daily or weekly basis to a remote server/MySQL DB. I know how to do this from the command line using MySQL:
But i need to be able to issue this command from within an ASP page. PHP has various methods for executing command line queries such as exec() & shell_exec() but I don't know any using ASP.
The following statement works fine in SQL Query Analyser: SELECT count(*) as a from NEWUSERS WHERE activated='Y'; SELECT count(*) as b from NEWUSERS WHERE activated='N' -- It returns two values, yet when I have it in a .asp file, it only displays the first value. Is there anyway around this, without making two connections to the DB, and running two seperate queries?
I am running two queries on a single page and they essentially work, the only problem is that i am unsure exactly how to get one aspect to function properly.
To explain it correctly it will probably be easier to just show you the code, the first query looks like this: Code: