Connection String Server.mappath Method
Wondered if anyone could help me out with some simple connection string problems I'm having.
Ive got this on the page so far and it works:
----------------------------------------------
Dim strConnString
set strConnString = server.createobject("adodb.connection")
strConnString.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=c:Inetpubwwwrootdlnforumforumadminwwforum.mdb"
strConnString.open
-----------------------------------------------
But I want to change it to a Server.MapPath method, so I tried the following:
------------------------------------------------
Dim strConnString
set strConnString = server.createobject("adodb.connection")
strConnString.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & Server.MapPath("forum/admin/wwforum.mdb")
strConnString.open
---------------------------------------------------
But now I get the following error:
-------------------------------------------
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4E)
Operation was canceled.
Can anyone help me out?
View Replies
ADVERTISEMENT
I need to map a path to my database file automatically, if I move the application to a different direcotry level I still have to write part of the path to get the application to work.
Is there anyway I can translate the directory path and place inside the mappath function so I dont have to manually edit it?
cst = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" &
server.mappath("shopsmartnetworkcartcart.mdb")
View Replies
View Related
I have a site with the directory structure like this:
wwwroot (where the default.asp and other pages sit)inc (where the includes are)login (where login pages are)otherDirs (where other pages are)datafiles (where database is)
I usually hard code the db connection path but want to use the MapPath now in case in the future my site moves servers (have been though that and having to manually change all db connection strings - Not Fun ) Code:
View Replies
View Related
How can I pass the results of a form field submitted to this statement
below?
<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
'### This Works
'###Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath("body.txt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(" &
request.form("MyFileName") & "))
WHILE NOT MyTextFile.AtEndOfStream
Response.Write(MyTextFile.ReadLine & Chr(10))
WEND
MyTextFile.Close
%>
View Replies
View Related
I am coping a file from server to local on my computer using:
fso.CopyFile Server.MapPath("downloadworkfile.htm"), Server.MapPath("p:workingworkfile.htm"), true
I am getting MapPath method must be a virtual path. How do I reference a virtual path?
View Replies
View Related
I ALWAYS forget this cause we ALWAYS turn our db connections into COM components. That said... I need one for this project . Here's my base Access one:
DBPath ="C:datastoresmediacd.mdb"
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DBPath
I just don't quite remember the SQL Server variation.
View Replies
View Related
We are planning to change the port that SQL Server is listening on at our Web Hosting company(TELUS).
Our SQL Server is being attacked. There are thousands of unauthorized attempts to login.
Is it possible to specify port number
in ASP code?
here is my cn:
PROVIDER=SQLOLEDB.1;DATA SOURCE=MachineName;INITIAL CATALOG=DatabaseName;USER ID=iserid;PASSWORD=password;
How should it look like if let's say our SQL port is 32566?
View Replies
View Related
can anyone provide a page that can do simple sql by using sql server 2005? I need it.
View Replies
View Related
I am working on a App. at my work place, now wanting to set it up at home
but for some reason I keep getting this error :
ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another.
I did some research on the NET but I am still unable to figure out why I
cannot connect to my db. Code:
View Replies
View Related
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DRIVER={SQL Server}; Server=;Database=pubs;Uid=myUsername;Pwd=myPasswor d;"
Instead of database, how can I set the DSN in this connection string?
DSN is DSNName. I am trying to connect to a SQL Server 2000 database.
View Replies
View Related
I seem to be getting this error, and after Googling and searching this site, I still can't get a grip on it. I have a site on a server which is being developed for a national company who will offer this site to their members, hosting each on the national orgainzations servers. I have this string -
openStr = "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("../databases/srt.mdb")
Which results in this error:
The '..' characters are not allowed in the Path parameter for the MapPath method
Ok, the common solution seems to be a configuration on the server, which wouldn't be a problem IF the site was to remain where it is. BUT, seeing as I will give this site to the client, who will host it on their servers, could this configuration "fix" be a problem, perhaps for security issues.
View Replies
View Related
If I have multiple websites on the same server,can I use the #include directive to reference include files elsewhere on the server? I tried this -
<!--#include file="C:InetpubvhostsATRAMEMBER.COMhttpdocsheader.asp" -->
But no dice...
View Replies
View Related
Which of the following would be the most preferred connection string method? What is the difference?
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/marketing/ics.mdb")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/marketing/ics.mdb")
View Replies
View Related
what is more efficient, opening the database once in the beginning of the page then closing it at the end of the page, or opening the db connection each time you need it.
for example:
i have a page that executes 50 queries. is it better to open the db, execute the queries, then close it, or to open and close the db 50 times?
View Replies
View Related
I work with ASP for several weeks now and i really like it! But until now i have just used it in connection with my localhost. I made connections to a SQL Database and to an ACESS Database with using the ODBC Tool from WIndows!!
Now i want to publish my website but i don't know how to handle the connection string kind of thing. My MySQL-Database is on a different server than the website and i need a connection string where i can type in the server, a password and a username and it should then connect.
View Replies
View Related
How do you use server.mappath to update a access database on a completely different computer? One of my websites needs to update a database on a completely different website. Code:
View Replies
View Related
I 've coded an asp webpage where a user could toggle a boolean value through a checkbox.
When the checkbox was pressed, the page posted the toggle action to itself, a
connection.execute "UPDATE tableName SET fieldName=(Not fieldname) WHERE field_id=1
query was performed and the checkbox, after I had retrieved its new value through a recordset, changed its appearence(state). At first I used an MS Access DB and it worked fine.
After I had switched the hole application to work with MS-SQL, although I changed the above query to Code:
View Replies
View Related
[This question is directed at Bob Barrows, but perhaps someone else knows an
answer. In any case it is good information for the group.]
I really like Bob's "stored procedure as method of Connection Object"
technique. It is convenient, compact, and concise, and simplifies protection
from SQL injection.
HOWEVER, I cannot figure out a way to pass a null value to an INT parameter
when I use this. Null string parameters are fine. The error reads:
Microsoft OLE DB Provider for SQL Server error '80040e07'
Operand type clash: text is incompatible with int
As you can imagine, "text is incompatible with int" gets my attention. I am
explicitly passing a null (not the string "null"). I am using JScript on the
web server and connecting to SQL Server 2000. An example: Code:
View Replies
View Related
Set objFile = objFSO.GetFile(Server.MapPath(strFileName))
this line brings up this error:
----------
Error Type:
Microsoft VBScript runtime (0x800A0035)
File not found
/Turbomaster/presupuesto_confirm.asp, line 67
------------
the variable strFileName is being read correctly..
View Replies
View Related
there is an image folder in my root directoty containing images. When I run the following code from a file located in root directory, the file gets deleted. But when I put the file in some other folder, it generates error FILE NOT FOUND.
aND YES, i'VE TRIED BOTH
fso.deletefile(server.mappath("Images/"&photo))
fso.deletefile(server.mappath("/Images/"&photo))
<%
dim fso
photo="902392.jpg"
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.deletefile(server.mappath("Images/"&photo))
%>
View Replies
View Related
I am running exactly the same ASP code on IIS 5.0 and IIS 6.0
I am calling Server.MapPath(), the parameter is a virtual path that includes a reference to a parent path ("Root/Files/../Config/"). 'Config' is a virtual directory under 'Root' which is also a virtual directory. 'Files' is a normal folder.
Under IIS 5.0, the path is correctly mapped to the local path of the 'Config' virtual directory.
Under IIS 6.0, the path gets mapped to "C:WebSiteRootFiles..Config", ignoring the 'Config' virtual directory mapping. Is there a special setting I should be aware of in IIS 6.0 to ensure correct
mapping of virtual paths?
View Replies
View Related
I just don't understand it and I know I must be over complicating things.
strCon= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("diary.mdb")
but then I create a new folder called for instance 'database' and move my diary.mdb into it(with full permissions), what do I change the server.mappath to?
View Replies
View Related
My web site has three folders:
htdocs
logs
private
I want to access an MS Access database in the 'private' directory from scripts within the 'htdocs' folder.
Part of my connection string reads:
Data Source=" & Server.MapPath("../private/test.mdb")
But the page returns the following error:
Could not find file '[my web site]htdocsest.mdb'
Why is it still looking in the 'htdocs' folder when my connection string points to the 'private folder?
View Replies
View Related
The Windows OS allows commas in file/folder names but if you try to call .Code:
Server.MapPath("/smith, john/")
your application will neatly halt and provide you with an error report.Other than telling your site/network users not to use commas as allowed in the OS what can the application designer do to avoid the error.I am sure a kludgey workaround is to scan for the comma, change the file/folder name to something safe then restore the name at the end. I don't think this is a safe way to do things though.
View Replies
View Related
Code:
<%=Server.MapPath(rsCurrImgs("nvcLinkPath"))%>
Gives a strange error. When I do it like this: rsCurrImgs("nvcLinkPath")it works fine. What can it be?
Quote: Error Source: NULL
Category: Server.MapPath()
Description: Invalid Path Character
Full Description: An invalid character was specified in the Path parameter for the MapPath method.
View Replies
View Related
if you have an address
/dir/wwwroot/andy
and you use
server.mappath("/dir/andy")
you recieve the physical path , i.e. c:.inetpub/wwwroot/dir/andy
is there a way of going the other way ie from a physical path to a virtual path?
View Replies
View Related
I'm trying to create a log file of users accessing my site. This I can do on the current server using server.mappath, but I can't figure out how to write to a file on a different server.
View Replies
View Related
I'm trying to use the server.mappath function on a web site hosted on win
2000 professional.
Is this feature not on win 2000 pro?
It simply produces 'page not found' Code:
View Replies
View Related
I need to use Server.Execute for dynamic includes. My files are located in different folders and what works for one doesn't work for another. I need to include the full path to the file because relative paths do not work. Can someone tell me how to do something like this:
Server.Execute(Server.MapPath("./") & "includessubnavigationdefault.asp")
I keep getting this error:
Invalid URL form or fully-qualified absolute URL was used. Use relative URLs.
The problem is I NEED to use relative URLs some how.
View Replies
View Related
I have an asp file that gathers info from a form and sends to the database. im now changing the location of the database from the root path. I think that because of this i cannot use Server.MapPath method of sending data.
Coudl someone please help me out and let me know how i would change the code? Im quite new to this as you could probably see. Code:
View Replies
View Related
Anyone know how i can add other webserver files using server.mappath?
View Replies
View Related
I just took up the task of learning ASP, done all the hello world stuff and then thought about the DB side of things and thought that a login system would be a nice place to start, so naturally I started with the registration page, and asp page to do the actual DB stuff, but it would seem I have a prob with Server.MapPath. So I edited my Register page to test and sure enough it doesn’t work, but it works when I make a page with just a .Write of the Server.MapPath Code:
View Replies
View Related
I have a project where multiple sites in separate folders use the same db. My dbconn include file is causing this error.
Server.MapPath() error 'ASP 0173 : 80004005'
Invalid Path Character
/rboggs/fu/fu021/assign6/includes/dbconn.asp, line 9
An invalid character was specified in the Path parameter for the MapPath method.
here is my code
[hightlight="ASP"]
<%
Dim cnnEXDB
I have no clue what is wrong here any help would be greatly appreciated
View Replies
View Related