<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Oledb" %>
<Script Language="C#" Runat="Server">
public void Page_Load(Object src,EventArgs e)
{
//各种String的设置
string MyConnString = "Provider=SQLOLEDB;server=(local);database=USD;UId=sa;Pwd=";
string strSel1 = "select * from UDS_Class";
string strSel2 = "select * from UDS_Flow";
string strSel3 = "select * from UDS_Role";
DataSet MyDataSet = new DataSet();
OleDbConnection MyConnection = new OleDbConnection(MyConnString);
//打开DataAdapter
OleDbDataAdapter MyAdapter1 = new OleDbDataAdapter(strSel1,MyConnection);
OleDbDataAdapter MyAdapter2 = new OleDbDataAdapter(strSel2,MyConnection);
OleDbDataAdapter MyAdapter3 = new OleDbDataAdapter(strSel3,MyConnection);
//将各表的数据,存入DataSet
MyAdapter1.Fill(MyDataSet,"UDS_Class");
MyAdapter1.Fill(MyDataSet,"UDS_Flow");
MyAdapter1.Fill(MyDataSet,"UDS_Role");
//交给DataGrid显示数据
DataGrid1.DataSource = MyDataSet.Tables["UDS_Class"].DefaultView;
DataGrid1.DataSource = MyDataSet.Tables["UDS_Flow"].DefaultView;
DataGrid1.DataSource = MyDataSet.Tables["UDS_Role"].DefaultView;
DataGrid1.DataBind();
DataGrid2.DataBind();
DataGrid3.DataBind();
}</Script><html>
<head><title>测试DataSet</title></head>
<body>
<form runat="server">
<ASP:DataGrid id="DataGrid1" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
<hr>
<ASP:DataGrid id="DataGrid2" runat="server" AllowPaging="True" PageSize="4" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
<hr>
<ASP:DataGrid id="DataGrid3" runat="server" AllowPaging="True" PageSize="4" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
</form>
</body>
</html>
解决方案 »
- System.IndexOutOfRangeException: summary
- VS2008怎么没用过,怎么用?
- componentart menu 一行代码求助
- 一个很古老的问题。
- 这个错误提示页面
- 在线等~~~~asp.net中怎么在页面关闭时处理事务完了再关闭?
- 在线求救:Microsoft JScript 运行时错误: 'contentWindow.document' 为空或不是对象
- 汗!急死了!一个网页链接问题!各位帮帮忙
- 类似于百度搜索的输入一个字显示提示 的功能怎样实现好?
- 在WPF中使用WebBrowser的问题
- 有没有打印web页面上内容的例子或思路 ,c#
- 跪求 有什么办法 可以让dropdownlist绑定2个字段的值
MyAdapter1.Fill(MyDataSet,"UDS_Class");
MyAdapter1.Fill(MyDataSet,"UDS_Flow");
MyAdapter1.Fill(MyDataSet,"UDS_Role");
//将各表的数据,存入DataSet
MyAdapter1.Fill(MyDataSet,"UDS_Class");
MyAdapter2.Fill(MyDataSet,"UDS_Flow");
MyAdapter3.Fill(MyDataSet,"UDS_Role");
DataGrid1.DataSource = MyDataSet.Tables["UDS_Class"].DefaultView;
DataGrid1.DataSource = MyDataSet.Tables["UDS_Flow"].DefaultView;
DataGrid1.DataSource = MyDataSet.Tables["UDS_Role"].DefaultView; //交给DataGrid显示数据
DataGrid1.DataSource = MyDataSet.Tables["UDS_Class"].DefaultView;
DataGrid2.DataSource = MyDataSet.Tables["UDS_Flow"].DefaultView;
DataGrid3.DataSource = MyDataSet.Tables["UDS_Role"].DefaultView;
最好用try catch 或 using最好用SqlConnection......
看别人的代码把
到www.51aspx.com 下载一个留言板什么的看看
你很多地方都要注意
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Oledb" %>
<Script Language="C#" Runat="Server">
public void Page_Load(Object src,EventArgs e)
{
//各种String的设置
string MyConnString = "Provider=SQLOLEDB;server=(local);database=USD;UId=sa;Pwd=";
string strSel1 = "select * from UDS_Class";
string strSel2 = "select * from UDS_Flow";
string strSel3 = "select * from UDS_Role";
DataSet MyDataSet = new DataSet();
OleDbConnection MyConnection = new OleDbConnection(MyConnString);
//打开DataAdapter
OleDbDataAdapter MyAdapter1 = new OleDbDataAdapter(strSel1,MyConnection);
OleDbDataAdapter MyAdapter2 = new OleDbDataAdapter(strSel2,MyConnection);
OleDbDataAdapter MyAdapter3 = new OleDbDataAdapter(strSel3,MyConnection);
//将各表的数据,存入DataSet
MyAdapter1.Fill(MyDataSet,"UDS_Class");
MyAdapter2.Fill(MyDataSet,"UDS_Flow");
MyAdapter3.Fill(MyDataSet,"UDS_Role");
//交给DataGrid显示数据
DataGrid1.DataSource = MyDataSet.Tables["UDS_Class"].DefaultView;
DataGrid2.DataSource = MyDataSet.Tables["UDS_Flow"].DefaultView;
DataGrid3.DataSource = MyDataSet.Tables["UDS_Role"].DefaultView;
DataGrid1.DataBind();
DataGrid2.DataBind();
DataGrid3.DataBind();
}</Script><html>
<head><title>测试DataSet</title></head>
<body>
<form runat="server">
<ASP:DataGrid id="DataGrid1" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
<hr>
<ASP:DataGrid id="DataGrid2" runat="server" AllowPaging="True" PageSize="4" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
<hr>
<ASP:DataGrid id="DataGrid3" runat="server" AllowPaging="True" PageSize="4" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
</form>
</body>
</html>
--------------------------------------------------------------------------------分析器错误
说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。 分析器错误信息: 服务器标记的格式不正确。源错误:
行 40: <body>
行 41: <form runat="server">
行 42: <ASP:DataGrid id="DataGrid1" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
行 43: <hr>
行 44: <ASP:DataGrid id="DataGrid2" runat="server" AllowPaging="True" PageSize="4" PagerStyle-Mode="NumericPages" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size"8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
源文件: C:\Inetpub\wwwroot\DataSet1.aspx 行: 42
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
提示的很清楚<ASP:DataGrid xxxxx xxxxx >
</ASP:DataGrid>
这里没有等号
应该是Font-Size="8pt"