空连接字符串 [英] empty connection string

查看:90
本文介绍了空连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在使用包含文件将连接字符串存储到数据库。

每当我尝试将该字符串引用到在页面中打开一个连接

包含文件我收到错误''empy connection string''。当我使用response.write(connectionstring)将字符串写入页面时,它显示

罚款。是否需要做其他事情?


谢谢

Hi,

I''m using an include file to store the connection string to a database.
Whenever I try to reference that string to open a connection in the page
that includes the file I get the error ''empy connection string'' . When I
write the string to the page using response.write(connectionstring) it shows
up fine. Is the something else that I need to do?

Thanks

推荐答案

AMC写道:


我正在使用包含文件将连接字符串存储到
数据库。每当我尝试引用该字符串以在包含该文件的页面中打开
连接时,我得到错误''empy
连接字符串''。当我使用
response.write(connectionstring)将字符串写入页面时,它显示正常。是否需要做其他事情?

谢谢
Hi,

I''m using an include file to store the connection string to a
database. Whenever I try to reference that string to open a
connection in the page that includes the file I get the error ''empy
connection string'' . When I write the string to the page using
response.write(connectionstring) it shows up fine. Is the something
else that I need to do?

Thanks




啊!我看到了!问题在第22行 - 就在那里的第15个角色!

你不明白吗?!?


哦等等......都没有我呢!你忽略了发布产生

错误的代码。


;-)

Bob Barrows


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

NO SPAM



Ah! I see it! the problem is on line 22 - right there at the 15th character!
Don''t you see it?!?

Oh wait ... neither do I! You neglected to post the code that generated the
error.

;-)

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


对不起,


这是包含文件的代码:顺便说一下,这个连接字符串

直接从页面使用时工作正常,而不是从

包含文件中引用。


<%


constr =" Driver = {MySQL}; SERVER =本地主机;端口= 0;选项= 0;

Socket = / home / greyso2 / greysonproperties.com / .database / mysql / mysql.sock;

DATABASE = greyso2_Greyson; UID = greyso2; PWD = kramer;"


%>

这里是包含此文件的asp页面的代码:


<! - #include virtual =" /db.asp" - >


<%

set conn = server.CreateObject(" ADODB.Connection")

conn.Open constr

%>

再次谢谢

Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom>在消息中写道

news:e
Sorry,

Here is the code for the include file: By the way this connection string
works fine when used directly from a page rather than referenced from an
include file.

<%

constr = "Driver={MySQL}; SERVER=localhost; Port=0; Option=0;
Socket=/home/greyso2/greysonproperties.com/.database/mysql/mysql.sock;
DATABASE=greyso2_Greyson;UID=greyso2; PWD=kramer;"

%>
Here''s the code for the asp page that includes this file:

<!--#include virtual="/db.asp"-->

<%
set conn = server.CreateObject("ADODB.Connection")
conn.Open constr
%>
THanks again
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:e


************* @ TK2MSFTNGP12.phx.gbl ...
*************@TK2MSFTNGP12.phx.gbl...
AMC写道:


我正在使用包含文件将连接字符串存储到
数据库。每当我尝试引用该字符串以在包含该文件的页面中打开
连接时,我得到错误''empy
连接字符串''。当我使用
response.write(connectionstring)将字符串写入页面时,它显示正常。是否还有其他我需要做的事情?

谢谢
啊!我看到了!问题出在第22行 - 就在15号
Hi,

I''m using an include file to store the connection string to a
database. Whenever I try to reference that string to open a
connection in the page that includes the file I get the error ''empy
connection string'' . When I write the string to the page using
response.write(connectionstring) it shows up fine. Is the something
else that I need to do?

Thanks
Ah! I see it! the problem is on line 22 - right there at the 15th



字符!你不明白吗?!?

哦等等......我也不是!你忽略了发布产生
错误的代码。

;-)
Bob Barrows

-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我不经常检查它。如果您必须离线回复,请删除
NO SPAM


character! Don''t you see it?!?

Oh wait ... neither do I! You neglected to post the code that generated the error.

;-)

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"



这篇关于空连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆