页面default3.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace
="CrystalDecisions.Web" TagPrefix="CR" 
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title>Untitled Page</title>
    
<link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
        rel
="stylesheet" type="text/css" />
</head>
<body>
    
<form id="Form1" method="post" runat="server">
        
&nbsp;&nbsp;<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:hdbpbjConnectionString %>"
            SelectCommand
="SELECT * FROM [users]"></asp:SqlDataSource>
        
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
        
</CR:CrystalReportSource>
        
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
  
</form>
</body>
</html>

default3.cs

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;

public partial class Default3 : System.Web.UI.Page
{
    
    
protected void Page_Load(object sender, EventArgs e)
    
{
        DataView rows 
= (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
        CrystalReportSource1.Report.FileName 
= "test.rpt";
        CrystalReportSource1.ReportDocument.SetDataSource(rows);
        CrystalReportViewer1.ReportSource 
= CrystalReportSource1;
    }
            
    

}


 如此简单,害的我不知道登录失败怎么处理这么长时间!发布出来与大家共享吧。

posted on 2007-03-19 18:07  mecn  阅读(917)  评论(2编辑  收藏  举报