【发布时间】:2015-08-25 09:16:14
【问题描述】:
我尝试使用 Visual Studio 2012 上的 asp Web 应用程序处理 http get 并将 get 数据插入到我的 oledb 数据库中。 我创建了一个 html 项目,并将扩展名从 html 更改为 asp。
这是我的代码:
<%
'declare the variables
Dim Connection
Dim Recordset
Dim SQL
Dim objRS
Dim objConn
Dim strConnect
'Option Explicit
Dim nome, ID
nome = Request.Querystring("Name")
ID = Request.Querystring("Id")
'declare the SQL statemant that will query the db
SQL = "INSERT INTO tablename (NomeFileNotifica, IDErrore, ISNew) VALUES ('"+nome+"', "+ ID +", 1)"
StrConnect = "PROVIDER=MICROSOFT.JET.OLEDB.4.0; Data Source = ***; Database = dbname; User ID = username; Password=password;"
Set objConn = Server.CreateObject(ADODB.Connection)
objConn.Open "tablename" , strConnect
Set objRS = Server.CreateObject(ADODB.Recordset)
objRS.Open SQL, objConn, 0 ,1
' .. More processing of the other variables .. '
'Processing / validation done... '
Response.Write nome & vbCrLf
Response.Write ID & vbCrLf
%>
Get 处理程序运行良好,但如果我尝试连接到我的数据库,则会出现以下错误
Object required: 'Server
在这一行:
Set objConn = Server.CreateObject(ADODB.Connection)
所有的 ASP 脚本都在 HTML 页面的正文中。 我在互联网上找不到任何解决方案,而且我在 ASP 方面没有太多经验。有人可以帮助我吗? 谢谢
【问题讨论】:
标签: sql iis visual-studio-2012 asp-classic oledb