SQL SERVER问题

zeybow 2000-08-25 08:56:00
我用asp开发时sql server,出现以下错误提示:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

这是什么错误?
...全文
213 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanjf 2000-09-08
  • 打赏
  • 举报
回复
看看每个表的字段定义是否一致。
hhzh426 2000-09-01
  • 打赏
  • 举报
回复
msdn:
PRB: ODBC Error when Passing Date Parameters to SQL Stored Proc
Last reviewed: December 11, 1997
Article ID: Q174638
The information in this article applies to:
Microsoft Visual InterDev, version 1.0


SYMPTOMS
One of the following errors occurs when passing a date to a SQL Stored Procedure:


Microsoft OLD DB Provider for ODBC Drivers error 80004005
At least one parameter contained a type that was not supported.

-OR-

Microsoft OLD DB Provider for ODBC Drivers error 80040e21
Driver not capable.


CAUSE
The data type of the parameter being passed to the stored procedure does not match the data type the stored procedure is expecting. For example, passing a value of "7/21/97" to a stored procedure that is expecting DateTime data will cause the error.



RESOLUTION
Make sure the data type you are passing to the stored procedure is of the same type as the stored procedure is expecting. Using Visual InterDev's Data Command control to create the Active Server Pages (ASP) code to call your stored procedure will ensure the parameter is of the correct type.



STATUS
This behavior is by design.



MORE INFORMATION


Steps to Reproduce Behavior

Create or open a Visual InterDev project.

Add a data connection to the "Pubs" database on your SQL server.

From the Data View tab, right-click the Stored Procedures folder for the "Pubs" database and choose "New Stored Procedure" from the context menu.

Copy/paste the code between the "===" lines below into the new stored procedure.


========new stored procedure code==========
CREATE PROCEDURE sp_custom_sel
@custdate datetime

AS

SELECT *
FROM employee
WHERE employee.hire_date=@custdate

===========================================



Create a new ASP file in the project.

Copy/paste the code below


======ASP file to call stored procedure===================
<%@ LANGUAGE="VBSCRIPT" %>



<HTML>
<HEAD>



<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html;
charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>



<%
Set pubs = Server.CreateObject("ADODB.Connection")
pubs.ConnectionTimeout = Session("pubs_ConnectionTimeout")
pubs.CommandTimeout = Session("pubs_CommandTimeout")
pubs.Open Session("pubs_ConnectionString"),
Session("pubs_RuntimeUserName"), Session("pubs_RuntimePassword")
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set DataCommand1 = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "dbo.""sp_custom_sel"""
cmdTemp.CommandType = 4
Set cmdTemp.ActiveConnection = pubs
Set tmpParam = cmdTemp.CreateParameter("Return Value", 3, 4, 4)
cmdTemp.Parameters.Append tmpParam



'*************************************
'The 7 in the "CreateParamter" below defines the passed value
'-"7/18/61"-as a Date data type. Changing the 7 to 135 defines the
'passed value as a Datetime data type, which the stored procedure is
'expecting. For more information on data type values, see the "Type
'Property" topic in InfoView.
'*************************************
Set tmpParam = cmdTemp.CreateParameter("@custdate",
7, 1, 16,"7/18/97")


cmdTemp.Parameters.Append tmpParam
'DataCommand1.Open cmdTemp, , 0, 1
cmdTemp.execute
%>
</BODY>
</HTML>
==============================================================



Preview the ASP page. The error described in the SYMPTOMS section above will appear.

Change the 7 in the "CreateParameter" line of the ASP to 135. Save and run the ASP page. No error will appear.

REFERENCES
For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:


http://support.microsoft.com/support/vinterdev/


Keywords : VIADO VIODBC
Component : dao
Technology : kbInetDev
Version : WINDOWS:1.0
Platform : WINDOWS
Issue type : kbprb

wuf 2000-08-27
  • 打赏
  • 举报
回复
你这个问题ASP很喜欢出来,凡是对数据库的操作有问题,恐怕都有这句话
关键是ADO语句写得怎么样
你可以来这里看看http://wuf.yeah.net/的专业教程
longzu 2000-08-26
  • 打赏
  • 举报
回复
肯定是代码出错,检查你的ASP程序!
xtra 2000-08-25
  • 打赏
  • 举报
回复
检查数据库的连接是否正确。一般会在这出问题。
蝈蝈俊 2000-08-25
  • 打赏
  • 举报
回复
晕倒,这叫什么错误,错误行代码打出来
本课程根据讲师十多年在世界500强外企的生产环境中的SQL Serer数据库管理和项目实施经验倾心打造。课程系统性强,知识体系完整,覆盖90%以上的企业环境下SQL Server高可用场景,课程中不仅演示详细的操作步骤,更加突出最常见的故障和问题,让学员少走“弯路”,不只是让学员学会“操作”更能让学员“操作”的规范,满满的干货分享,一些课程资料(架构图、部署规划表格等)不仅可以帮助学员掌握技能,也可以作为学员在企业生产环境中实施SQL Server高可用的配置文档、操作手册等。课程的实验环境介绍:1)全部基于微软域环境和企业版SQL Server AOAG - 95%以上的企业环境都是在域环境中,不介绍非域环境和标准版的SQL Server高可用性组,这的配置在企业中较罕见,没有实践意义,不浪费学员时间。2)相应域环境已提前部署和配置好 - 学员导入虚拟机即可开始实验,无需从零开始搭建域环境,所有实验中SQL Server均已加域,直入主题,节省大量时间。3)最新的Windows Server故障转移集群(WS2016、WS2019)和最新版本的SQL ServerSQL2017、SQL2019) -  WS2016-SQL2017与WS2019-SQL2019是目前大多数企业SQL Server高可用的主要平台,基于微软产品生命周期现在一些企业也在讲早期的AOAG向这两个版本迁移,掌握这两种组合不仅让学员学会,更能学有所用。本课程为后续SQL Server进阶课程铺垫,是通向SQL Server DBA 专家的必经之路,讲师每周答疑两次。所有课程资料包括:课程PPT、架构图、部署规划表格、各类脚本学员均可下载。     

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧