I created a ADODB.Connection object in Session On_Start and tried to connect to the databse On_Start. It is giving errors. Can't have a connection opened only once in a whole applicatio like VB.
The Con variable is available for the whole session but the connection state is not available for the whole session. Do I need to open a connection everytime I want to access a database????
Basically, I have an asp application that uses a database connection, and I want to declare (create) that connection in an include and use it throughout the application in various functions. I've tried making the connection object a public variable, a constant, making the functions public, passing the connection object in byRef, byVal, etc... I just can't get it to work. Is this not possible in classic ASP? Code:
I am making a testing project to get my hands on ASP classic. I have a question about Global Scope Variables e.g in PHP we make a file where we define some values which are global, e.g site URL, site title etc, and then we can include that in any page to get that value.
I read Global.asa works very good in fact we dont need to include that in every page to use stuff within this file. I read some examples but they are mostly about functions in this file. Can anybody guide me please how to define variables in Global.asa to use them sitewise?
There are many web sites on the server - each has a virtual directory pointer to a common directory containing frequently used routines. Scripts run from the virtual directory appear to have no access to session (or application) variables. Is this expected behaviour? Or have I yet to track down a bug?
Does anyone know of a way to enumerate the local variable scope? The reason I ask is that I have a function that dumps the contents of response,request,server,etc... for debugging purposes. I'd like to also display the local variables.
I have a piece of vbscript that returns the user logged on to the machine. it is as follows:
<script language="vbscript"> Set WshNetwork = createObject("WScript.Network") stringUser = (WshNetwork.userName) 'store username in variable stringUser document.write("Username: " & stringUser) 'output value to web page </script>
Now I need to use the value of stringUser on other pages of my asp application for database queries, form values etc. I have tried to call stringUser from inside <%..........%>, but it doesn't recognize the variable. Everytime I try to output the value from wthin asp code, it just appears as blank space. Any ideas?
This has been puzzling me for very long time and no where has talked about the scope of a 'On Error Resume Next' statement.
When we program ASP(.NET) pages then we usually like to let ASP(.NET) stop at errors and report back to us. However there are parts of our scripts that we know an error will be thrown and we encapsulate that area inbetween:
On Error Resume Next Err.Clear 'Try block If Err.Number Then 'Catch block End If On Error GoTo 0
This is similar to the infamous try {} catch(e) {} blocks in Java/C++, etc.
If we forget the last line 'On Error GoTo 0' then our ASP(.NET) scripts runs over all errors thrown and we find it hard to find bugs. So the big question is, does 'On Error Resume Next' go out of scope when it's written inside a block (eg. Function)?
Function Function1() On Error Resume Next 'Our code End Function
When the Function1 call returns, does the outside calling scope automatically stays as it was (On Error GoTo 0)?
I wanted to know wheather DSN is ok for the connection to a database or direct conection is better?
when i started my web project on dreamweaver i had to make a DSN connection as i have followed the books, but as now as i have also asked several questions on this site, i have aslo implemented a direct connection as well on some pages, now i am wondering is this going to have any affects when i uplode the complete site on the server.
i have noticed that on my computer when i am testing the site and uploading new records on sections that have DSN connections you can see the new record but on sections that i have implemented direct connection i cannot see it coz it is linked to the local directory database not on the testing server.
i have also never experienced uploading to a IIS server with DB connection so its my first time with dynamic websites. so am i in trouble or its ok the way i have done my site..
I am trying to create a web page that has a drop down menu in which it retrieves data from our SQL server. Maybe this is a bit more simple than I am making it but I am really pulling my hair out trying to get this right. Code:
this is my error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.
here is my db connection string:
<%@Language=VBScript%> <!--#include file="adovbs.inc"--> <% dim rs, cn Set cn = Server.CreateObject("ADODB.Connection") 'with cn ' .Provider="Microsoft.jet.oledb.4.0" ' .ConnectionString=Server.MapPath("home/nfiweb.mdb") ' .Open 'end with cn.open "nfijobs" set rs = Server.CreateObject("ADODB.Recordset") %>
When I click submit after updating the information all of my info gets deleted from the db so I'm guessing that the values that are being submitted are not getting picked up in the sql. I've tried changing the form names, etc, but still have the same prob. My code is below: Code:
I am having trouble connecting to an Access db fro mmy asp page. I get the following error: The page cannot be displayed There is a problem with the page you are trying to reach and it cannot be displayed. Code:
' -- Our SQL Statement response.write "Declaring SQL Statement" strSQL = "SELECT * FROM TIMES" ' -- Populate our Recordset with data Set objRS = GetRecordset(strConnection, strSQL)
I have done many searches but all the connection strings I've found seem to be using a DSN to an access DB. Currently I get this error when trying to connect.
Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I can't seem to find the proper syntax to specify a db login (sa) and password in the connection string.
on 1 page i open a connection to a database and build a recordset to check username and password. there are other fields in the db that i need to access on the next page. how do i reference that connection and run a new sql query without having to reopen the connection? i thought it would be as simple as NOT closing it, but thats not working.
I am having problem in my connection to database when running ASP. It works fine for the first time but if I run it again without a gap of atleast a minute, it gives me the following error message:
And the line it is showing error is where I am opening my database connection using conn.open.If I wait for couple of minutes and run again,it works fine.
I'm trying to maintain a permanent tcp/ip connection between two computers using ASP. I need users accessing the ASP pages to be able to send and receive messages using this connection. I know that I can't use a Winsock control with ASP so I guess I'm looking at a third party control. Even if I can get this working I'm not sure that I can have different users accessing this one permanently open connection. I've looked all over the Net for ideas on how to do this but I've had no luck. Has anyone had to do anything like this?
I am trying to establish an ODBC conection to ORACLE 10g and have tried all the following. Please advise:
We are trying to connect to a 10 g server and nearly gone crazy after doing so. tried everythign, DSN, DSN less .... The bottom line the connection is successful when we try it form the control panel-> data source thing but not from ASP. We tried the following things: Code:
I created a master detail page using the wizard in Dreamweaver, however I need to create a DSN-less connection. How do I do that? I am assuming I need to edit this part of my code:
I am getting 500 Internal Server Error. I have tried disabling the show friendly error in IE and I have tried it on Firefox. It will not give me the reason why it will not work, I only get 500 Internal Server Error.
I have tested the code up to the point of Set objConn and it works but when it gets to the objConn.open dsn that's when I get the error. I wish to find out why it is not allowing it to get pass this point. I have control of the server where this is hosted and if there is anything I need to do, I can do it.
I am trying to create a web page on our company intranet.I am using Frontpage 2000.I need to be able to read from and write to databases in this project.I am starting slow since I am just learning, so for now I am trying to read from an existing SQL database on a network server. The server is running SQL Server 2000 and IIS.
I could create a database connection using the Database Results Wizard in FP. The connection would verify OK and I could select the columns from the table I wanted to display. When I published the page to the server, all I got was column headings, no data.
when I try to create a new db connection, it will verify, but it will not show up as an existing db connection.
need to connect DB2 tables on mainframe, using a ASP front end...But I do not know how to... what all things I should enquire & need in the system before doing the same. connection format to connect a databse on mainframe.
My client have a allready built database. and now need to access that database with asp. How do i connct to a sql database through asp? Would like to use mapPath() in stead of a DSN. Could only find DNS examples on the net.
I just want to import this part of VBscript file to an asp code to help my frined. This part of code is working if I run it as a vbscript on the command line, but we could not get it run in a asb files.
I have no idea of how to connect to my database (access) to my asp pages using DSN (ODBC). I've already upload my database file in the folder called db and I've already added DSN. Can you guys provide me some sample code?
Iam trying to connect to my database using dreamweaver but I am told that I do not need it ! I can't understand how am I supose to use my Database? I refere to DSN, user name and passoword, but I was told no need for it as I can just do some coding, so is there anyway I can code it ?
my host company cannot understand that I need a DSN connection and when I asked about the password they tell me...no need for it.
I have a client Gallery i am setting up for clients to view and approve their work online in their private area, the database is set up the way i want it, and the site has been set up as an individual site (Gallery only) which i will then transfer onto the backend of my site.... (client entry)
But i want to be able to just copy the whole folder Client Gallery mentioned above) into a new subfolder for a new client and continue to do so for each client, so they will be able to view their work without me having to change anything in my ASP pages every time i get a new client, the database uses a link to the images & their not stored directly in Access.
if i use the same database and DNS but its in a different folder along with its gallery script and script pages it uses, will it only refer to that new folder its in and folders following or will it search the whole directoy within the site and get confused due to the same database connection with different images or different linked folders.
Set dbConn= Server.CreateObject("ADODB.Connection") dbConn.Open "DSN=somedsn; UID=someuser; PWD=somepassword"
To (try) to connect to an Oracle DB: ASP 'hangs' in the dbConn.Open statement if a valid connection string is supplied. If an invalid string is supplied (e.g., the DSN doesn't exist), the dbConn.Open statement returns immediately, with appropriate error messages.
If connection is attempted outside of the IIS environment (e.g., by some other VB application) using the same connection methods, no problems are encountered. I tried both ODBC or OLEDB, it does not work at all.
I need to create some .asp pages to publish data from our manufacturing lines...but I can't figure out how to establish the connection string and print the data. I've been stuck on this all day and about to start pulling my hair out!!!
As an example, can someone create the most basic code necessary to build a web page that does the following:
a) connect to a SQL version of the Northwind db (assume I have a functioning ODBC connection called 'Northwind_ODBC' on a server called 'ProductionServer')
b) Loop through the records in the [Shippers] table and paste the values in a HTML table (using SELECT * FROM SHIPPERS)
I know it sounds simple but I'm looking through some books and can't find a solution that works on my server.
NOTE: I'm running Server 2003 (with IIS), SQL Server 2000, and I have proven ASP does work on this machine...unfortunately, just not with the code I'm trying to build!!!