初学asp.net,手生得很,各位帮忙看看第8行void Page_Load( Sender As Object,E as EventArgs )
的错误由那一行引起的?<%@ Page language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %><script runat="server" >
void Page_Load( Sender As Object,E as EventArgs )
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
String strConnect;
String strCommand;
DataSet DataSet1=new DataSet();
strConnect="server=server;uid=sa;pwd=;database=db1"; strCommand="select * from department"
objConnection=new OleDbConnection(strConnect)
objCommand=new OleDbDataAdapter(strCommand,objConnection);
objCommand.Fill(DataSet1,"branch");
DataGrid1.DataSource=DataSet1.Tables("branch").DefaultView;
DataGrid1.DataBind();
}</script><html>
<head>
<title>Data Grid Control example </title>
</head>
<body>
<asp:DataGrid id="DataGrid1" runat="server" />
</body>
</html>
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS1026: 应输入 )源错误: 行 6:
行 7:
行 8: void Page_Load( Sender As Object,E as EventArgs )
行 9: {
行 10: OleDbConnection objConnection;
源文件: F:\wwwroot\try\try.aspx 行: 8
F:\wwwroot\try\try.aspx(8,31): error CS1026: 应输入 )
F:\wwwroot\try\try.aspx(8,37): error CS1519: 类、结构或接口成员声明中的标记“,”无效
F:\wwwroot\try\try.aspx(8,40): error CS1519: 类、结构或接口成员声明中的标记“as”无效
F:\wwwroot\try\try.aspx(8,53): error CS1519: 类、结构或接口成员声明中的标记“)”无效
F:\wwwroot\try\try.aspx(17,15): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(19,15): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(20,18): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(20,23): error CS1520: 类、结构或接口方法必须有返回类型
F:\wwwroot\try\try.aspx(20,49): error CS1001: 应输入标识符
F:\wwwroot\try\try.aspx(20,50): error CS1002: 应输入 ;
F:\wwwroot\try\try.aspx(21,15): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(21,20): error CS1520: 类、结构或接口方法必须有返回类型
F:\wwwroot\try\try.aspx(21,47): error CS1001: 应输入标识符
F:\wwwroot\try\try.aspx(21,61): error CS1001: 应输入标识符
F:\wwwroot\try\try.aspx(22,20): error CS1519: 类、结构或接口成员声明中的标记“(”无效
F:\wwwroot\try\try.aspx(22,29): error CS1519: 类、结构或接口成员声明中的标记“,”无效
F:\wwwroot\try\try.aspx(23,25): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(23,41): error CS1519: 类、结构或接口成员声明中的标记“(”无效
F:\wwwroot\try\try.aspx(23,63): error CS1519: 类、结构或接口成员声明中的标记“;”无效
F:\wwwroot\try\try.aspx(24,23): error CS1519: 类、结构或接口成员声明中的标记“(”无效
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(82,16): error CS1518: 应输入 class、delegate、enum、interface 或 struct
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(107,25): error CS1518: 应输入 class、delegate、enum、interface 或 struct
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(167,25): error CS1518: 应输入 class、delegate、enum、interface 或 struct
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(171,1): error CS1022: 应输入类型、命名空间定义或文件尾
的错误由那一行引起的?<%@ Page language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %><script runat="server" >
void Page_Load( Sender As Object,E as EventArgs )
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
String strConnect;
String strCommand;
DataSet DataSet1=new DataSet();
strConnect="server=server;uid=sa;pwd=;database=db1"; strCommand="select * from department"
objConnection=new OleDbConnection(strConnect)
objCommand=new OleDbDataAdapter(strCommand,objConnection);
objCommand.Fill(DataSet1,"branch");
DataGrid1.DataSource=DataSet1.Tables("branch").DefaultView;
DataGrid1.DataBind();
}</script><html>
<head>
<title>Data Grid Control example </title>
</head>
<body>
<asp:DataGrid id="DataGrid1" runat="server" />
</body>
</html>
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS1026: 应输入 )源错误: 行 6:
行 7:
行 8: void Page_Load( Sender As Object,E as EventArgs )
行 9: {
行 10: OleDbConnection objConnection;
源文件: F:\wwwroot\try\try.aspx 行: 8
F:\wwwroot\try\try.aspx(8,31): error CS1026: 应输入 )
F:\wwwroot\try\try.aspx(8,37): error CS1519: 类、结构或接口成员声明中的标记“,”无效
F:\wwwroot\try\try.aspx(8,40): error CS1519: 类、结构或接口成员声明中的标记“as”无效
F:\wwwroot\try\try.aspx(8,53): error CS1519: 类、结构或接口成员声明中的标记“)”无效
F:\wwwroot\try\try.aspx(17,15): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(19,15): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(20,18): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(20,23): error CS1520: 类、结构或接口方法必须有返回类型
F:\wwwroot\try\try.aspx(20,49): error CS1001: 应输入标识符
F:\wwwroot\try\try.aspx(20,50): error CS1002: 应输入 ;
F:\wwwroot\try\try.aspx(21,15): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(21,20): error CS1520: 类、结构或接口方法必须有返回类型
F:\wwwroot\try\try.aspx(21,47): error CS1001: 应输入标识符
F:\wwwroot\try\try.aspx(21,61): error CS1001: 应输入标识符
F:\wwwroot\try\try.aspx(22,20): error CS1519: 类、结构或接口成员声明中的标记“(”无效
F:\wwwroot\try\try.aspx(22,29): error CS1519: 类、结构或接口成员声明中的标记“,”无效
F:\wwwroot\try\try.aspx(23,25): error CS1519: 类、结构或接口成员声明中的标记“=”无效
F:\wwwroot\try\try.aspx(23,41): error CS1519: 类、结构或接口成员声明中的标记“(”无效
F:\wwwroot\try\try.aspx(23,63): error CS1519: 类、结构或接口成员声明中的标记“;”无效
F:\wwwroot\try\try.aspx(24,23): error CS1519: 类、结构或接口成员声明中的标记“(”无效
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(82,16): error CS1518: 应输入 class、delegate、enum、interface 或 struct
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(107,25): error CS1518: 应输入 class、delegate、enum、interface 或 struct
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(167,25): error CS1518: 应输入 class、delegate、enum、interface 或 struct
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d4c67892\b630d07c\zv2fsfgd.0.cs(171,1): error CS1022: 应输入类型、命名空间定义或文件尾
objConnection=new OleDbConnection(strConnect)少了;
应为
strCommand="select * from department";
objConnection=new OleDbConnection(strConnect);
劳烦各位再看看.
不管中间哪一行出了问题,compiler认定第8行"error CS1026: 应输入 )",呵呵
void Page_Load(object sender, System.EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
String strConnect;
String strCommand;
DataSet DataSet1=new DataSet();
strConnect="server=server;uid=sa;pwd=;database=db1"; strCommand="select * from department" ;
objConnection=new OleDbConnection(strConnect);
objCommand=new OleDbDataAdapter(strCommand,objConnection);
objCommand.Fill(DataSet1,"branch");
DataGrid1.DataSource=DataSet1.Tables["branch"].DefaultView;//是[],不是()
DataGrid1.DataBind();
}</script><html>
<head>
<title>Data Grid Control example </title>
</head>
<body>
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
</body>
</html>
objConnection=new OleDbConnection(strConnect)提示都出来了,自己不找?
编译器错误信息: CS1026: 应输入 )不就少了分号么?
你的代码是VB的还是C#的。