数据库插入动作成功,可是在生成web页是出现错误
sp_runwebtask 必须在 sp_makewebtask 的 dbname 所指定的同一数据库中执行。
详情可参照SQL帮作

解决方案 »

  1.   

    检查sp_runwebtask的问题.
     Transact-SQL 参考  
    sp_runwebtask
    执行先前定义的 Web 作业并生成 HTML 文档。要运行的任务由输出文件名或过程名标识,或者由两个参数同时标识。说明  所有 Web 作业在企业管理器的"作业分类"对话框中都被归为 Web 助手。有关更多信息,请参见定义作业。 
    语法
    sp_runwebtask [ [ @procname = ] 'procname' ]
        [ , [ @outputfile = ] 'outputfile'参数
    [@procname =] 'procname'是要运行的 Web 作业过程的名称。指定的过程定义了 Web 作业的查询。procname 为 nvarchar(128) 类型,无默认值。[@outputfile =] 'outputfile'是指定 Web 作业的输出文件名。outputfile 为 nvarchar(255) 类型,无默认值。返回代码值
    0(成功)或非零数字(失败)注释
    sp_runwebtask 必须在 sp_makewebtask 的 dbname 所指定的同一数据库中执行。系统管理员不应使用 SETUSER 测试 sp_runwebtask。扩展过程并不理会新用户的安全上下文。要测试适当的安全授权,请创建临时用户 ID 和密码。使用这一临时帐户登录并测试 sp_runwebtask。测试完成后删除临时帐户。由 sp_runwebtask 生成的输出是真正的 HTML 源代码。可使用大多数文字处理应用程序查看源文档。重要  sp_dropwebtask、sp_makewebtask 和 sp_runwebtask 只能在 Microsoft® SQL Server™ 6.5 版及其更高版本的数据库上运行。在以前版本的数据库中运行这些过程会返回错误。
    当某作业定期调度运行时,SQL Server 代理必须处于运行状态。否则将不能生成 .htm 页。所有 Microsoft Windows® 95/98 Web 助手的用户都必须在正使用的数据库中有用户帐户。使用 sp_adduser 向每个用户可能访问的数据库添加帐户。当运行 Windows 95/98 操作系统时,按需分配任务只能由作业所有者或系统管理员运行。权限
    用户要运行由 Web 作业使用的指定查询,就必须具有 SELECT 权限。示例
    下例使用 @outputfile 参数 C:\Web\Myfile.html 和 @procname 参数 MYHTML 运行 Web 作业。sp_runwebtask @procname = 'MYHTML', @outputfile = 'C:\WEB\MYFILE.HTML' 
    请参见sp_dropwebtasksp_makewebtask系统存储过程©1988-2000 Microsoft Corporation。保留所有权利。
      

  2.   

    楼上的兄弟的帮助文档已经很详细了,我分析有可能是web页和数据库连接有错误
      

  3.   

    去检查sp_runwebtask的问题.呀
    提示都说了,你要按提示去查看 一下。
      

  4.   

    --建立环境:if object_id('csdn') is not null drop table csdn
    if object_id('p_csdn') is not null drop proc p_csdn
    create table csdn(id int identity(1,1),title nvarchar(100),url nvarchar(200),memo nvarchar(200))
    go
    create proc p_csdn as select top 2 * from csdn
    go
    insert csdn values(N'分最高的贴',N'http://expert.csdn.net/Expert/TopicView1.asp?id=1561946',N'480分,只有总版主才能这么放分')
    insert csdn values(N'回贴次数最多的贴',N'http://expert.csdn.net/Expert/TopicView1.asp?id=1344408',N'P3 800 + 512M + win2kas 也打不开太大了!你要有思想准备 (2469个回帖)')
    insert csdn values(N'三星回复最多的贴',N'http://expert.csdn.net/Expert/TopicView1.asp?id=1305645',N'是那个智者弄出来的杰作')
    insert csdn values(N'最歪的贴',N'http://expert.csdn.net/Expert/TopicView3.asp?id=1474251',N'会报一个错,但可以打开,不知是什么时候弄出来的')
    go
    一、HTML :
    1、普通网页报表例:(具体参数可参考SQLServer联机)
       exec sp_makewebtask 'c:\查询输出.html','select * from csdn exec p_csdn',@lastupdated=0,@resultstitle='两个结果集'2、普通带超连结的报表例:(@resultstitle不要标题是两个空格,后面的@url_query参数中的查询,第一列是地址,第二列是描述)
       exec sp_makewebtask 'c:\带超链接.html','exec p_csdn',@lastupdated=0,@resultstitle='  ',@table_urls=1,@url_query='select url,title from csdn'3、定时网页监控:(@whentype是调度类型,@targetdate是生成页的日期,@numunits=周期,@unittype=对应周期单位)
       declare @now int set @now=cast(convert(char(8),getdate(),112) as int)
       exec sp_makewebtask 'c:\当前会话.html','exec sp_who2 exec master..xp_cmdshell ''net session''',@whentype=4,@targetdate=@now,@numunits=1,@unittype=1,@resultstitle='机器当前用户和进程的信息及机器会话',@webpagetitle='当前会话'
       注意:用这个来删除web作业:  sp_dropwebtask null,'c:\当前会话.html'4、使用模版:
      建立例子模版:在C:\下新建内容为下面的一“模版.htp”
        <html><title>模版例子</title><body><table border=0 cellspacing=1 cellpadding=5 bgcolor="#CCCCCC"><tr><td><%insert_data_heree%></td></tr></table></body></html>
      exec sp_makewebtask 'c:\模版实例.html','select * from csdn',@templatefile='c:\模版.tpl',@lastupdated=0,@resultstitle='  '