修改动网论坛表记录时总说参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
现有一处理页面,将前一页面传递过来的参数进行处理,主要是一个用户表和动网的用户表,其中用户表的处理能顺利通过,但是将前一页传递过来的email和sex字段进行动网用户表的对应记录的修改时总说参数类型不正确.
处理页do.asp代码如下:
<!--#include file= "../bbs/Conn.asp " -->
<!--#include file= "../bbs/inc/const.asp "-->
<!--#include file= "../bbs/inc/chkinput.asp "-->
<!--#include file= "Conn.asp " -->
<!--#include file= "../Inc/Config.asp " -->
<!--#include file= "Inc/Session.asp " -->
<!--#include file= "../Inc/Char.asp " -->
<!--#include file= "../Inc/md5.asp " -->
<!--#include file= "Inc/CheckLevel.asp " -->
...
Dim Sql1,Rs1,UserName
UserName=session( "User_Name ")
Set Rs1=Server.CreateObject( "ADODB.RecordSet ")
Sql1= "Select Top 1 * From Dv_User Where UserName= ' "&UserName& " ' "
Rs1.Open Sql1,conn,1,3
Rs1( "UserEmail ")=Request.Form( "Email ")
Rs1( "UserSex ")=Request.Form( "Sex ")
Rs1( "UserMobile ")=Request.Form( "Mobile ")
Rs1.Update
Rs1.Close:Set Rs1=Nothing
总卡在Rs1.Open Sql1,conn,1,3这一行,而关于动网论坛的conn.asp代码如下:
Db = "../bbs/data/dvbbs7.mdb "
SqlNowString = "Now() "
End If
Const IsDeBug = 1
Set Dvbbs = New Cls_Forum
Set template = New cls_templates
Sub ConnectionDatabase
Dim ConnStr
If IsSqlDataBase = 1 Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & "; "
Else
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(MyDbPath & db)
End If
On Error Resume Next
Set conn = Server.CreateObject( "ADODB.Connection ")
conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。 " '注释,需要把这几个字翻译成英文。
Response.End
问题出在哪里呢?
session( "User_Name ")是有值的,不存在为空的情况.
------解决方案--------------------应该是conn对象打开数据库时失败,导致你的recordset对象操作数据表失败
------解决方案--------------------如果不是conn打开数据库出错,那就检查rs1之前是否关闭以及你修改该表的权限问题
------解决方案--------------------没有找开数据库吧!
驱动程序没有写对!