【问题标题】:connectivity error vbscript sqlserver?连接错误vbscript sqlserver?
【发布时间】:2011-07-12 03:22:23
【问题描述】:
<%@ language="vbscript" %>
<html>
<body>
<P>
<%

dim adOpenDynamic,adLockOptimistic,adCmdtext

adOpenDynamic=0

adLockoptimistic=1

adCmdtext=2
dim i
i=1
dim conn,rs,strsql
dim fname,lname,gender,month,date,year,uname,pwd,email


set conn=Server.Createobject("ADODB.Connection")
set rs=Server.Createobject("ADODB.Recordset")

conn.ConnectionString="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=myshoppe;Data Source=NVC-10\SQLEXPRESS"

conn.Open

fname=Request.Form("first_name")
lname=Request.Form("last_name")
gender=Request.Form("gender")
'month=Request.Form("Month")
'date=Request.Form("date")
'year=Request.Form("year")
email=Request.Form("email")
uname=Request.Form("user_name")
pwd=Request.Form("pwd")

strsql = "INSERT INTO user_info(fname, lname, gender, email, uname, pwd) VALUES(' " & fname & "',' " & lname &"',' " & gender & "',  "& email & "',' " & uname & "',' " & pwd & "')"                                                                

conn.Execute (strsql)
Response.Write("submitted<>")

Response.Write "Connected OK"


%>
<br>


</P>

</body>
</html>

用于 SQL 的 Microsoft OLE DB 提供程序 服务器 (0x80040E09) INSERT 权限 拒绝对象'us​​er_info',数据库 “myshoppe”,架构“dbo”。

【问题讨论】:

  • Integrated Security=SSPI 意味着您的脚本可能以 ASPNET、IIS_IUSR 或 IIS_WPG 用户身份运行。检查用户在 SQL Server 中是否具有正确的权限。否则,如果是错误的用户,您可以选择更改运行 ASP 的用户。

标签: sql-server vbscript connection-string oledb adodb


【解决方案1】:

您需要在电子邮件变量之前添加一个单引号。

【讨论】:

  • 我得到了那个错误,然后我又得到了另一个错误。我编辑了我的问题
  • 你用来连接数据库的用户没有插入权限。您需要让该用户更多地访问数据库。
猜你喜欢
  • 2016-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多