Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 192227 - Last Review: March 2, 2005 - Revision: 4.2
INFO: ADO 2.0 Command Object ConnectionString Property Changes
This article was previously published under Q192227
Active Server Pages (ASP) applications written with ActiveX Data Objects (ADO) that pass the ADO ConnectionString property using either HTTP POST or GET fail to connect.
ADO 2.0 returns the ConnectionString with the "Extended Properties"
argument in double-quotes. Passing this value to an HTML property may
result in the ConnectionString value being truncated at the first double-
quote encountered.
An example of the ConnectionString property returned using ADO 2.0 follows:
Provider=MSDASQL.1;Data Source=test;Connect Timeout=15;
Extended Properties="DSN=test;DBQ=C:\Data\MyData.mdb;
DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5;";
Locale Identifier=1033
To resolve this issue, replace the double quotes with the HTML variable
""". This can be accomplished using the Server.HTMLEncode() in an
Active Server Page.
WARNING! The following sample is intended only as an example. Including an
ODBC connect string in HTML source could present a breach in security by
exposing userids, passwords and the location of data in clear text and is
not a recommended practice.
Sample Code
<%@ LANGUAGE="VBScript"%>
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "MyConnectString"
%>
<form method=post action=myasp.asp>
<input type=hidden name=txtConnString
value="<%=Server.HTMLEncode(objConn.ConnectionString)%>">
<input type=submit value=" Go! ">
</form>
APPLIES TO
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft Internet Information Server 4.0
- Microsoft Internet Information Services 5.0
- Microsoft Active Server Pages 4.0
| kbcode kbdatabase kbinfo kbmdacnosweep KB192227 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate