为什么出现这种提示: 20
usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingS...
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
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.Xml.Linq;
using System.Data.Common;
using System.Data.SqlClient;
public partial class todayData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strConn="Data Source=hao-pc;Initial Catalog=simpleBBS;Persist Security Info=True;User ID=sa;Password=123";
System.Data.Common.DbProviderFactory dbProviderFactory=System.Data.Common.DbProviderFactories.GetFactory("System.Data.SqlClient");
System.Data.Common.DbConnection dbConn=dbProviderFactory.CreateConnection();
dbConn.ConnectionString=strConn;
dbConn.Open();
DbDataAdapter dbDataAdapter=dbProviderFactory.CreateDataAdapter();
DbCommand dbComm=dbProviderFactory.CreateCommand();
dbComm.CommandText="Select * from information";
dbComm.Connection=dbConn;
dbDataAdapter.SelectCommand=dbComm;
DataSet dsDataSet=new DataSet();
dbDataAdapter.Fill(dsDataSet,"information");
DataTable dtTable=new DataTable();
DataColumn newColumn=new DataColumn();
newColumn.ColumnName="date"; //显示"Invalid token'=' in class struct or interface member declaration"
newColumn.DataType=System.Type.GetType("System.String");
newColumn.AutoIncrement=false;
newColumn.ReadOnly=true;
newColumn.Unique=true;
dtTable.Columns.Add(newColumn);
newColumn=new DataColumn();
newColumn.ColumnName="numbers";
newColumn.DataType=System.Type.GetType("System.Int32");
newColumn.AutoIncrement=false;
newColumn.ReadOnly=true;
newColumn.Unique=false; //can it been skipped?
dtTable.Columns.Add(newColumn);
newColumn=new DataColumn();
newColumn.ColumnName="percentage";
newColumn.DataType=System.Type.GetType("Sytstem.String");
newColumn.AutoIncrement=false;
newColumn.ReadOnly=true;
newColumn.Unique=false;
dtTable.Columns.Add(newColumn);
DataRow newRow;
for(int i=0;i<24;i++)
{
newRow=dtTable.NewRow();
newRow["date"]=i+":00--"+(i+1)+":00";
newRow["numbers"]=timeCome[i];
if(dayCome!=0)
{
newRow["percentage"]=((float)timeCome[i]/dayCome*100+"%";
}
else
newRow["percentage"]="nobody";
dtTable.Rows.Add(newRow);
}
GridView1.DataSource=dtTable;
GridView1.DataBind();
}
在浏览器中的错误提示:
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
Source Error:
Line 59: DataColumn newColumn=new DataColumn();
Line 60:
Line 61: newColumn.ColumnName="[date]";
Line 62: newColumn.DataType=System.Type.GetType("System.String");
Line 63: newColumn.AutoIncrement=false;
Source File: c:\Users\hao\Documents\Visual Studio 2008\qiMing2\todayData.aspx.cs Line: 61 展开
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
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.Xml.Linq;
using System.Data.Common;
using System.Data.SqlClient;
public partial class todayData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strConn="Data Source=hao-pc;Initial Catalog=simpleBBS;Persist Security Info=True;User ID=sa;Password=123";
System.Data.Common.DbProviderFactory dbProviderFactory=System.Data.Common.DbProviderFactories.GetFactory("System.Data.SqlClient");
System.Data.Common.DbConnection dbConn=dbProviderFactory.CreateConnection();
dbConn.ConnectionString=strConn;
dbConn.Open();
DbDataAdapter dbDataAdapter=dbProviderFactory.CreateDataAdapter();
DbCommand dbComm=dbProviderFactory.CreateCommand();
dbComm.CommandText="Select * from information";
dbComm.Connection=dbConn;
dbDataAdapter.SelectCommand=dbComm;
DataSet dsDataSet=new DataSet();
dbDataAdapter.Fill(dsDataSet,"information");
DataTable dtTable=new DataTable();
DataColumn newColumn=new DataColumn();
newColumn.ColumnName="date"; //显示"Invalid token'=' in class struct or interface member declaration"
newColumn.DataType=System.Type.GetType("System.String");
newColumn.AutoIncrement=false;
newColumn.ReadOnly=true;
newColumn.Unique=true;
dtTable.Columns.Add(newColumn);
newColumn=new DataColumn();
newColumn.ColumnName="numbers";
newColumn.DataType=System.Type.GetType("System.Int32");
newColumn.AutoIncrement=false;
newColumn.ReadOnly=true;
newColumn.Unique=false; //can it been skipped?
dtTable.Columns.Add(newColumn);
newColumn=new DataColumn();
newColumn.ColumnName="percentage";
newColumn.DataType=System.Type.GetType("Sytstem.String");
newColumn.AutoIncrement=false;
newColumn.ReadOnly=true;
newColumn.Unique=false;
dtTable.Columns.Add(newColumn);
DataRow newRow;
for(int i=0;i<24;i++)
{
newRow=dtTable.NewRow();
newRow["date"]=i+":00--"+(i+1)+":00";
newRow["numbers"]=timeCome[i];
if(dayCome!=0)
{
newRow["percentage"]=((float)timeCome[i]/dayCome*100+"%";
}
else
newRow["percentage"]="nobody";
dtTable.Rows.Add(newRow);
}
GridView1.DataSource=dtTable;
GridView1.DataBind();
}
在浏览器中的错误提示:
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
Source Error:
Line 59: DataColumn newColumn=new DataColumn();
Line 60:
Line 61: newColumn.ColumnName="[date]";
Line 62: newColumn.DataType=System.Type.GetType("System.String");
Line 63: newColumn.AutoIncrement=false;
Source File: c:\Users\hao\Documents\Visual Studio 2008\qiMing2\todayData.aspx.cs Line: 61 展开
展开全部
newColumn.ColumnName="[date]"; //显示"Invalid token'=' in class struct or interface member
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
啥提示?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询