[英]ASP, DSN-Less connection, connection string syntax gives Data source name not found error
This is the error message 这是错误消息
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
Microsoft OLE DB提供程序的ODBC驱动程序错误'80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
[Microsoft] [ODBC驱动程序管理器]找不到数据源名称,未指定默认驱动程序
/Ute/ute_class.inc, line 1357
/Ute/ute_class.inc,第1357行
This is my Ute.ASP code 这是我的Ute.ASP代码
Dim sDSN
sDSN = "Data Source=MYSERV0000\PSAPP01; Initial Catalog=LibraryDB; User Id=admsa; password=sa"
PS: I am able to use the same string within my web.config, with .net 4.0 PS:在.net 4.0中,我可以在web.config中使用相同的字符串
Side comment ... don't use .inc files. 旁注...请勿使用.inc文件。 Very bad practice ... if you have an error on the page it may provide the name of your .inc that has your database connection.
不好的做法...如果页面上有错误,它可能会提供具有数据库连接的.inc名称。 Since the .inc page is not an .asp, if someone types in the URL for that .inc it will just come back as plain text.
由于.inc页面不是.asp,因此,如果有人输入该.inc的URL,它将以纯文本形式返回。 WHAM ... visitor now has your connection string.
WHAM ...访客现在有了您的连接字符串。 Convert it to an .asp and your problems are over.
将其转换为.asp,问题就解决了。
As far as the Connection String, there's too many possibilities to answer precisely so I'll just point you in the direction of http://connectionstrings.com/ Follow the right links and it should give you a template of what your connection string should be. 至于连接字符串,有太多的可能性可以精确地回答,所以我只为您指出http://connectionstrings.com/的方向。按照正确的链接进行操作,它应该为您提供连接字符串的模板是。
sDSN = "Provider=SQLNCLI;Server=SERVER\\INSTANCE;Database=exampleDB;Uid=admsa; Pwd=sa;"
makes it work 使它起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.