主题:  表单连ACCESS求助!急~

小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#12005/2/3 13:48:17
我的表单要实现的功能是向数据库中插入记录,已经建立了记录集,服务器行为也设置了插入数据,可每次点击提交的时候总出现这个界面:
本页无法显示
试图访问的网页出现问题,无法显示。
--------------------------------------------------------------------------------
请尝试以下方法:

单击 刷新按钮或者梢候再试。

打开 localhost 主页,然后查找与所需信息相关的链接。
HTTP 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(适用于支持人员)

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
/denglu2.asp, 第 115 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

页:
POST 351 bytes to /denglu2.asp

POST 数据:
%D3%C3%BB%A7%C3%FB=sunjingli&%D0%D5%C3%FB=sunjingli&%C3%DC%C2%EB=sunjingli&%C3%DC%C2%EB2=sunjingli&radiobutton=1&%C3%F1%D7%E5=%BA%BA%D7%E5&%CA%A1%B7%DD=1&%D1%A7%C0%FA=1&%B3%F6%C9%FA%C8%D5%C6%DA=123&%C . . .

时间:
2005年2月3日, 13:44:36


详细信息:
Microsoft 支持

DW中的代码如下:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/mymembers.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert") = "form1" Then

MM_editConnection = MM_mymembers_STRING
MM_editTable = "join_table"
MM_editRedirectUrl = "dengluok.asp"
MM_fieldsStr = "用户名|value|姓名|value|密码|value|radiobutton|value|民族|value|省份|value|学历|value|出生日期|value|身份证|value|联系电话|value|E-mail|value|联系地址|value|邮编|value"
MM_columnsStr = "id|',none,''|name|',none,''|password|',none,''|sex|',none,''|nationality|',none,''|province|',none,''|experience|',none,''|birthday|',none,''|number|',none,''|tel|',none,''|E-mail|',none,''|dress|',none,''|Postcode|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tablevalues
Dim MM_dbvalues

If (CStr(Request("MM_insert") <> "" Then

' create the sql insert statement
MM_tablevalues = ""
MM_dbvalues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tablevalues = MM_tablevalues & ","
MM_dbvalues = MM_dbvalues & ","
End If
MM_tablevalues = MM_tablevalues & MM_columns(MM_i)
MM_dbvalues = MM_dbvalues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tablevalues & " values (" & MM_dbvalues & ""

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_mymembers_STRING
Recordset1.Source = "SELECT * FROM join_table"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>



小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#22005/2/3 14:08:35
求各位大侠帮忙啊~~小弟感激不禁啊,我会在线等待各位的指教~~QQ28448842



小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#32005/2/3 14:10:34
不会这么冷清吧~~



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#42005/2/4 1:21:37
你打开数据库的那句程序出错了。



解决办法参考:
support.microsoft.com/default.aspx?scid=kb;EN-US;265320



小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#52005/2/5 19:54:23
大哥,你好厉害啊~~能不能让我加你的QQ啊~~~以后有事情可以直接请教你哦



小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#62005/2/5 19:55:26
啊??不会吧??网站是英文的哦~~我不懂鸟语



小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#72005/2/5 19:57:20
你能不能直接告诉我怎么改正这个语句呢?



小虾米

职务:普通成员
等级:1
金币:0.0
发贴:8
#82005/2/5 19:57:52
好象就一个语句有毛病



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#92005/2/5 20:08:09
转篇帖子给你。。。也许有用。

不过说回来。。。最好知道一点相关的鸟语。。。

好的资料少有中文的。。。。


------------------------------------------------------------------------------------------------------------------

下面将简单介绍一下几种ADO连接方式:ODBC DSN,ODBC DSN-Less,
OLE DB Provider,和"MS Remote" Provider.
1。ODBC DSN连接
I.DSN
oConn.Open "DSN=AdvWorks;" & _
"UID=Admin;" & _
"PWD=;"
注意:从MDAC2.1开始就不能够在使用这样的方式了,就是只把DSN文件名放在ConnectString中
你必须同时使用DSN,UID,PWD标志。例如下面的方式在MDAC 2.1中将会出错:
oConn.Open "AdvWorks"



II.File DSN
oConn.Open "FILEDSN=\somepath\mydb.dsn;" & _
"UID=Admin;" & _
"PWD=;"
III.ODBC DSN-Less Connections
a)ODBC Text Driver
oConn.Open _
"Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=\somepath\;" & _
"Extensions=asc,csv,tab,txt;" & _
"Persist Security Info=False"
注意:需要在SQL语句中指定使用到的文件名。例如:
oRs.Open "Select * From customer.csv", _
oConn, adOpenStatic, adLockReadOnly, adCmdText
b)ODBC Driver for Access
i)普通安全模式:
oConn.Open _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\somepath\mydb.mdb;" & _
"Uid=Admin;" & _
"Pwd=;"
ii)如果使用了System database:
oConn.Open _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\somepath\mydb.mdb;" & _
"SystemDB=\somepath\mydb.mdw;", _
"admin", ""
c)ODBC Driver for SQL Server
i)普通安全模式
oConn.Open "Driver={SQL Server};" & _
"Server=carl2;" & _
"Database=pubs;" & _
"Uid=sa;" & _
"Pwd=;"
ii)使用信任安全模式:
oConn.Open "Driver={SQL Server};" & _
"Server=carl2;" & _
"Database=pubs;" & _
"Uid=;" & _
"Pwd=;"
注意:要使用空白的Uid和Pwd
d)ODBC Driver for Oracle
i)使用现有的Oracle ODBC Driver from Microsoft:
oConn.Open _
"Driver={Microsoft ODBC for Oracle};" & _
"Server=OracleServer.world;" & _
"Uid=demo;" & _
"Pwd=demo;"
ii)使用老版本的Oracle ODBC Driver from Microsoft:
oConn.Open _
"Driver={Microsoft ODBC Driver for Oracle};" & _
"ConnectString=OracleServer.world;" & _
"Uid=demo;" & _
"Pwd=demo;"
IIII)使用微软的OLE DB Data Link Connections方式Data Link File (UDL)
a)使用绝对路径
oConn.Open "File Name=\somepath\pubs.udl;"
b)使用相对路径
oConn.Open "File Name=pubs.udl;"
V)OLE DB Provider Connections方式
a)OLE DB Provider for ODBC Databases
i)Access (Jet):
oConn.Open _
"Provider=MSDASQL;" & _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\somepath\mydb.mdb;" & _
"Uid=Admin;" & _
"Pwd=;"
ii)SQL Server:
oConn.Open _
"Provider=MSDASQL;" & _
"Driver={SQL Server};" & _
"Server=carl2;" & _
"Database=pubs;" & _
"Uid=sa;" & _
"Pwd=;"
b)OLE DB Provider for Microsoft Jet (Access)
i)普通安全模式:
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;" & _
"User Id=admin;" & _
"Password=;"
ii)如果使用了System database:
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=system.mdw;", _
"admin", ""
注意:当使用OLE DB Provider4.0版本是,需要把MDB和MDW文件转换成4.0的数据库格式
iii)如果MDB需要一个数据库密码的话:
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword;", _
"admin", ""
c)OLE DB Provider for Excel Spreadsheet:
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\expenses.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes;"";"
注意: "HDR=Yes"表示在第一行中是行标题,在provider中将不把第一行包括入recordset中
d)OLE DB Provider for SQL Server
i)普通安全模式:
oConn.Open "Provider=sqloledb;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=carl2;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=;"
ii)使用信任安全模式:
oConn.Open "Provider=sqloledb;" & _
Network Library=DBMSSOCN;" & _
"Data Source=carl2;" & _
"Initial Catalog=pubs;" & _
"Trusted_Connection=yes;"
注意:"Network Library=DBMSSOCN"声明OLE DB使用TCP/IP替代Named Pipes.
e)OLE DB Provider for Oracle
oConn.Open "Provider=msdaora;" & _
"Data Source=OracleServer.world;" & _
"User Id=sa;" & _
"Password=;"
(VI)Remote OLE DB Provider Connections方式(就是我一直在研究的RDS方式哦,呵呵。):
a)MS Remote - Access (Jet)
i)ODBC DSN:
oConn.Open "Remote Server=http://carl2;" & _
"Remote Provider=MSDASQL;" & _
"DSN=AdvWorks;" & _
"Uid=admin" & _
"Pwd=;"
ii)OLE DB Provider:
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://carl2;" & _
"Remote Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;", _
"admin", ""
iii)OLE DB Provider自定义事务对象
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://carl2;" & _
"Handler=MSDFMAP.Handler;" & _
"Data Source=MyAdvworksOLEDBConnectTag;"
b)MS Remote - SQL Server
i)ODBC DSN:
oConn.Open "Remote Server=http://carl2;" & _
"Remote Provider=MSDASQL;" & _
"Network Library=DBMSSOCN;" & _
"DSN=Pubs;" & _
"Uid=sa" & _
"Pwd=;"
ii)OLE DB Provider
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://carl2;" & _
"Remote Provider=SQLOLEDB;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=carl2;" & _
"Initial Catalog=pubs;" & _
"User ID=sa;" & _
"Password=;"