進來看看這段源碼﹗﹗﹗﹗﹗﹗﹗﹗(100分)

  • 主题发起人 主题发起人 lzm
  • 开始时间 开始时间
L

lzm

Unregistered / Unconfirmed
GUEST, unregistred user!
各位﹕
本人想做一ASP頁面﹐ 來維護SQL2000中的數據表。(客戶在WEB里報價﹐存入我的后台)
在ASP 和 SQL 連接時﹐無法通過。請看﹕
//--------------------------------
在IE5里運行時的出錯信息
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'LZMBAK/IUSR_LZMBAK'.
/Project/ASP Page1.asp, line 31

//--------------------------------
global.asa 文件
Application("Connection1_ConnectionString") = "DSN=shoe;UID=Administrator;APP=Microsoft Development Environment;WSID=LZMBAK;DATABASE=cbshoe;Network=DBMSSOCN;Trusted_Connection=Yes"
Application("Connection1_ConnectionTimeout") = 15
Application("Connection1_CommandTimeout") = 30
Application("Connection1_CursorLocation") = 3
Application("Connection1_RuntimeUserName") = "Administrator"
Application("Connection1_RuntimePassword") = ""
'-- Project Data Environment
Set DE = Server.CreateObject("DERuntime.DERuntime")
Application("DE") = DE.Load(Server.MapPath("Global.ASA"), "_private/DataEnvironment/DataEnvironment.asa")

//---------------------------------------
ASP里的數據庫連接調用
var DBConn = Server.CreateObject('ADODB.Connection');
DBConn.ConnectionTimeout = Application('Connection1_ConnectionTimeout');
DBConn.CommandTimeout = Application('Connection1_CommandTimeout');
DBConn.CursorLocation = Application('Connection1_CursorLocation');
DBConn.Open(Application('Connection1_ConnectionString'), Application('Connection1_RuntimeUserName'), Application('Connection1_RuntimePassword'));
var cmdTmp = Server.CreateObject('ADODB.Command');
var rsTmp = Server.CreateObject('ADODB.Recordset');
cmdTmp.ActiveConnection = DBConn;
rsTmp.Source = cmdTmp;
cmdTmp.CommandType = 2;
cmdTmp.CommandTimeout = 10;
cmdTmp.Prepared = true;
cmdTmp.CommandText = '"BWZL"';
rsTmp.CacheSize = 10;
rsTmp.CursorType = 2;
rsTmp.CursorLocation = 2;
rsTmp.LockType = 3;
Recordset1.setRecordSource(rsTmp);
Recordset1.open();
if (thisPage.getState('pb_Recordset1') != null)
Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
}
//---------------------------------------------------
從IE里登入SQL里用戶出錯。 可我有指定運行時的用戶名稱。
有資料稱IE登入SQL用戶名會時IUSR_XXXXX
連接不成功﹐啥事也無法做。請各位指教﹗
 
怎么﹐看的多說的少
歡迎大家發表意見﹗
 
IUSR_ServerName 是网站匿名访问用户
 
to:netke
// IUSR_ServerName 是网站匿名访问用户
可是登入我的SQL SERVER時總得有一個名字 呀
我該怎么做呢!
 
使用sa的帐号
 
對呀﹐我是用的sa,可總是提示出錯。
請大俠幫忙看看上面的代碼﹐哪個地方出錯了。
 
ODBC配置有错误,用户不对或没有权限。
请测试你的ODBC连接。
 
//请测试你的ODBC连接。
ODBC OK!
--------???? Login failed for user 'LZMBAK/IUSR_LZMBAK'. ???
SERVER=LZMBAK
 
請看出問題的地方如下﹔ie用匿名用戶IUSR_SERVER 我有指定運行時用戶
</SCRIPT>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==Visual InterDev Generated - startspan==
'--Project Data Connection
Application("Connection1_ConnectionString") = "DSN=shoe;User Id=sa;Description=shoe test ;UID=Administrator;APP=Microsoft Development Environment;WSID=LZMBAK;DATABASE=cbshoe;Network=DBMSSOCN;Trusted_Connection=Yes"
Application("Connection1_ConnectionTimeout") = 15
Application("Connection1_CommandTimeout") = 30
Application("Connection1_CursorLocation") = 3
指定運行時用戶 Application("Connection1_RuntimeUserName") = "sa" //-指定運行時用戶
Application("Connection1_RuntimePassword") = ""
'-- Project Data Environment
Set DE = Server.CreateObject("DERuntime.DERuntime")
Application("DE") = DE.Load(Server.MapPath("Global.ASA"), "_private/DataEnvironment/DataEnvironment.asa")
'==Visual InterDev Generated - endspan==
End Sub
</SCRIPT>
 
怎么沒人能答?????
 
Trusted_Connection=Yes时使用NT用户
administrator密码不是没有吧?!

将Trusted_Connection不设,用sa
 
ASP 和 SQL 需要这么多东东吗,
<%
dim connstr,conn
connstr="PROVIDER=SQLOLEDB;uid=Username;pwd=Password;DATABASE=DBname"
set conn = server.createObject( "adodb.connection" )
conn.Open connstr
%>
 
to: zippypig
thank you vety muck!

 
后退
顶部