Execute An Access Query
How can you use ASP code to execute an Access query. I want to run the query to then display updated data on the webpage.
View RepliesHow can you use ASP code to execute an Access query. I want to run the query to then display updated data on the webpage.
View RepliesUsing ASP, I would like to write down to the HTML the time taken to execute a query. I am trying to optimize my SQL queries in the ASP page. So I want to determine if my SQL query is optimal or not. So how can I determine how much time it took to execute the query and return the results.
For example, something like: It took 5 seconds.
I tried to run 2 queries in single connection. But it doesnt work to the second query
page will return an error but execute the frist query only. How can i solve this problem.
I'm using Microsoft Access 2000. Here are the code an error that return
Dim objConn, strSQL1, strSQL2
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=egbit_dev;"
strSQL1 = "Update ADM_USERTAB Set USER_PWD = '" & new_pwd & "' where USER_ID = '" & userid & "'"
set rsUpdate_Pwd = objConn.Execute(strSQL1)
strSQL2 = "Update EGBIT_PWD_STATUS Set password_status = 'change' Where user_id = '" & userid & "'"
set rsstatus = objConn.Execute(strSQL2)
error :
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
( it refering to line that execute set rsstatus = objConn.Execute(strSQL2) )
wat are the different ways i could execute this update query. Code:
sql="Update Employee Set name='"& name&"', age="& age &" location='"& loc &"'
Conn.Execute sql
the sql statement shows evrythings correct. but when i execute the update query...it shows syntax error in UPDATE statment.
After commands like:
tmpDBconn.Execute("DELETE * FROM mytable WHERE rc_id = 10" )
How do I check for errors?
Is there a way to check the results?
OR:
Set rsCatCount = tmpDBconn.Execute("SELECT COUNT(*) FROM cat WHERE key_id = 10 AND cat_id = 6")
How do I get the count? Do I use rsCatCount(0)?
My code retrieves a username and a password from a form. Then this information is compared to some usernames and passwords that are stored in a database. The important thing here is that the comparison must be case sensitive meaning that "passWord" is not the same thing as "password"
I have this code, working fine in access 2003
SQL = "SELECT * FROM users WHERE StrComp(username_column,'" & entered_username_in_form & "',0) = 0 AND StrComp(password_column,'" & entered_password_in_form & "',0) = 0"
but get the following error when I run it against my sql 2005 database.
[Microsoft][SQL Native Client][SQL Server]'StrComp' is not a recognized built-in function name.
I don't know the corresponding t-sql for the query.
I tried at least 10 different solutions for my problems and I stuck this time. The problem is I got this:
Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in UPDATE statement.
/webpage/Save.asp, line 45
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
Page: Code:
I am currently running IIS 5.1, Windows XP Pro with service pack 2. When I try to run an ASP page I get an error saying that 403.1 Execut Access Forbidden - IIS. There are no firewalls up and running. I hav given permission and access to everything, every folder that I can thin to give access to. Obviously I must be missing somethin somewhere. anyone have any ideas for me??? The execute permission have been set to scripts only. I have also tried scripts an executables.
I also have a box that I run the same asp pages on and the onl difference that I can find is that I am running Windows XP Pro wit service pack 1. I don't have any problems executing ASP on this box. I have tried to mirror all the setting from box to box and stil nothing.
I am using ASP/MS ACCESS to see how I can query the same database, via 2 formfields.
{name: - search}Textfield 1: - Search by Category
AND/OR By
{name: - searchT}Textfield 2: - Location
Currently,
strSearchwords = Trim(Request.QueryString("search")); where "search" is the name of Textfield1
Which is fine, but how can I set it so that on Submit, the string from search, and searchT are somehow joined together into one string?
What is this all about? Generally I run against SQL Server but now I have to use access. The query I want to run is a simple double join
SELECT tblArtists.*,tblGenres.name AS genreName,tblPages.pageId
FROM (tblArtists
INNER JOIN tblGenres ON tblArtists.genreId = tblGenres.genreId)
LEFT JOIN tblPages ON tblArtists.artistId = tblPages.artistId
ORDER BY surName ASC, firstName ASC
Now If I run this question in access against the database it accurateley returns two posts. BUT When I paste the same query into an asp document and runs it with a fileDSN against the same database it returns nothing!? Is this some kind of joke from Microsoft?
I'm trying to run an access query with one parameter that is a string. I can call a query that has no parameters. I can also call a query that has one parameter that is an integer. But the one that has a string parameter isn't working.
Here is the code:
[VBS]set rs = conn.execute("getArtists '" & ltr & "'")[/VBS]
I've tried using a command object and it did the same thing. Is there any other way I can get my query to return the records. Running it in access works.
I have a Acces query which creates a table using manipulated data from another table. I want my asp page to run this query after doing an update to the database.
View Replies View RelatedI've got a query that works fine when used in mySQL but completely fails
when I try to apply it to MS Access, weird thing is that it is just a copy
of a stored procedure that works fine in the same copy (with the
Request.QueryString replaced by a fixed value) ! Any explaination would be
great, ID is a number BTW :
SELECT page_title,ID,page_content FROM content WHERE ID='" &
Request.QueryString("ID") & "' '
Had a look at aspfaq.com but couldn't find anything that applys.
Is it possible to write an SQL statement that reads from an Access Query instead of an Access Table. If so is the syntax the same as for reading a Table.
View Replies View RelatedWhere I found this?
Like this:
SELECT
SELECT TOP N
INTO
FROM
WHERE
GROUP BY
HAVING
UNION (ALL)
ORDER BY
WITH OWNERACCESS
( http://msdn.microsoft.com/library/e.../access2sql.asp )
But with explanations (usage) and samples...
I have a field called store, I have more than 1 row with the same store name in the store field.
I need to coolect all the stores from the store field, remove any duplicates, like I might have buy.com twice and only need it to show once in the drop down. And sort ascending (by store name).
Summary.
Database is called: tracker
The table (and the only table) is called merchants
I only want to pull data from the field store, remove duplicate store names, sort ascending.
I can figure out how to plug the required htm around the asp code, to auto populate the drop down.
I'm using odbc and Classic ASP and I want to read the sql content of a query in an access database. ANyone have any clues?
View Replies View RelatedI am trying to query an Access database using the like operation; however, when I test the query in the browser all records from the database are displayed. Here is my code:
View Replies View RelatedI want to do a running total query , here is what i want :
I want the running total like this:
I'm attempting to limit a query which is being ordered by a date field to 10 records. The date field contains duplicate values, which are sorted from most recent, back.
However their suggestion of sorting by a secondary field is not providing acceptable results (it returns all the rows in the database). Does anyone have any suggestions of another way around this?
What is the best way to create new queries and/or modify existing tables within an online access database. At the moment, I am periodically downloading the db and making alterations. But, I have heard others on the list say they use a query analayzer built on
a <form> where they execute SQL statements. Is this the correct way to go?
I have the following query:
Update properties set Last_Change=#8-Mar-2006# Where properties.fdref='h3c000';
which works fine when I run it on my desktop under MS Access, but when I run it as an ASP page, I get the following error message:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
I am using the same database bot online and offline so field names etc are exactly the same.
I have an Access database that I created a query in. The query brings fields from related tables and prompts users to perform a search based on 3 criterias.
NOTE: the prompts can be bypassed by just leaving it blank and selecting OK. So in other words, the user does not need to fill in each prompt for the search to work, it just give them a more narrowed down search if they fill more in...
Now for the ASP part... I want to create an ASP page where the use selects from 3 drop downs. These drop downs are named the same as the field names in my query. How do I get this to work??
Currently, I do the following in my ASP pages when making use of an MS
Access database:
Dim adoCon, rsSet, strSQL
Set AdoCon = server.CreateObject("ADODB.Connection")
Set RsSet = Server.CreateObject("ADODB.RecordSet")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("MyDB.mdb")
strSQL="SELECT * FROM MyTable;"
rsSet.Open strSQL, adoCon
...do some stuff...
rsSet.Close
adoCon.Close
Set rsSet=Nothing
Set adoCon=Nothing
I have a couple queries stored in the database that I use when in MS Access.
Can I call these queries instead of using a string to specify the SQL
command?
The above seems kind of verbose for making use of a database. Can it be
simplified at all?
here's what i want to do. from an asp page, perform a search on a
table in access. i have used sql code in the asp page itself, but i'd
rather execute a query in access. i have success in running any query
(basic SELECT, SELECT with conditions _other_ than LIKE, etc..) for
some reason, when i execute the query below from the asp page, i get
no results.
the search.asp page just has a text box in a form that submits the
srchBOX field to the results.asp page.
here's the asp code from the results.asp page: Code:
I am trying to search through an access database for tickets createded with in a certin date. I am using the below code.
strdate = DateAdd("d", -2, Now())
sqlstr="SELECT * FROM Incidents WHERE TicketDate BETWEEN #"& Now() &"# AND #"& strdate &"# ;"
I verify the query with response.write and get the following.
SELECT * FROM Incidents WHERE TicketDate BETWEEN #15/07/04 19:19:32# AND #13/07/04 19:19:32# ;
I know there are 100% tickets within this date. Yet my query returns nuthing. Please help i've searched this forum for other peoples code looking for examples but end up with the same result.
When creating a virtual directory in IIS 5.0 win xp Pro with the name like
"abc.com", an error HTTP 403.1 Forbidden: Execute Access Forbidden will
return when accessing the web page. But, this will work fine if the virtual
directory is named in "abc.com.sg" or others. Why it can't be created with
the name "xxxxxx.com"??
We just upgraded our server from Windows 2000 to Windows 2003 Server, and when I try to execute an ASP request, I get the message below. I ensure that ASP was an allowed
file type, but still gives me the message.
-----error start------
HTTP Error 403
403.1 Forbidden: Execute Access Forbidden
This error can be caused if you try to execute a CGI,
ISAPI, or other executable program from a directory that
does not allow programs to be executed.
Please contact the Web server's administrator if the
problem persists.
-----error end ------
Getting an error using ASP with an Access database on a remote host (I don't control perms).
It's giving this error:
Microsoft JET Database Engineerror '80004005'Operation must use an updateable query. /admin/projects.asp, line 180
Isn't this normally just a permissins error?
The host says they've just given full permissions so it shouldn't a problem, but I want to confirm that this is a perms issue before I get too uppity.
It happens on every INSERT/UPDATE/DELETE that is attempted to be run, and the exact same SQL statements work perfectly on the local machine and network, so my gut instinct is perms.
The setup:
Access database of vendors. A vendor can offer one or more services.
ASP page provides user a checkbox of services. User clicks one or more options and submits. The database should return all vendors that match the services selected.
No dice. I can of course easily pull up vendors that match one service. But the multiple options are treated as an AND search. I don't want to find only vendors that provide all the services checked, but all the vendors that provide one or more of the services selected by the user.
I have tried stored procedures in Access and SQL statements. I either get data type errors or nothing found.
I am running a querry on an access database and have set the number of records/page displayed at 20. if there are more than 20 records returned, then 1st page will show the first 20, the next page will show next 20 and so on....
The trouble:
the count of total records displayed is correct and the first page is displayed correctly. But when i click on *Next* to go to the next page, all the records of the database get displayed (not the 2nd page of records from the query).
WEll I see that this issue is not yet solved ...
So here's some more beef...
There is an update the first part of the query that takes ~50 seconds
and the connection gets cut off at 30 sec sharp. Logical as the default value us 30 sec.
question :Does anyone know how to increase that value? I can't do it in the udl , it reverts back to nothing.
Option:
[1]I would/could also optimize that update using a hint to fasten it
[2] Or try to execute the proc without using the dsn?
Using ASP 3 on an ISP account (I don't have access to the root of the
server). I have a page that does some intake processing and I'd like to have
it run every 5 minutes. Right now, the only way I can see to do this is to
have a client task that wakes up every 5 minutes and opens that page.Is
there a better way?