我搜索了互联网,所有以前的答案都说分号丢失了。那不是问题。还有什么可以导致这个错误?在第三个站点,有几个人问了这个问题,但这种情况有所不同。
错误是> 类型或命名空间定义,或文件结尾预期 d
public partial class SeenSMS : System.Web.UI.UserControl
{
//temp sql connection
//public SqlConnection mycon;
SqlConnection mycon = new SqlConnection(@"Data Source=ASOFT20\MAMUT;Initial Catalog=ViltraNew;UserID=sa;Password=sa123");
protected void Page_Load(object sender, EventArgs e)
{
string[] msg_arr = Request.QueryString["arr"].Split('|');
if (!IsPostBack)
{
string Moose = Request.QueryString[1];
}
if (msg_arr != null)
{
if ((msg_arr.Length == 3) && (msg_arr[1].ToLower() == "slett"))
{
int Hours = Convert.ToInt32(msg_arr[2]);
if (Hours > 0)
{
string username = msg_arr[0];
SqlCommand com = new SqlCommand("SELECT count(*) as count FROM Animal Where Hours=@Hours", mycon);
com.Parameters.AddWithValue("@Hours",Hours);
using (SqlDataReader reader = com.ExecuteReader())
{
if(reader.HasRows)
{
while (reader.Read())
{
// int number = Convert.ToInt32(con.ExecuteReader());
int number = Convert.ToInt32(reader["count"]);
}
}
else{
}
}
}
// if( number == 0)
// {
// Response.Write("Improper Plain Summaries.");
// }
// else
{
}
}
}
}
public bool number { get; set; }
public object Hours { get; set; }}
// public System.Collections.Specialized.NameValueCollection Moose { get; set; }
// public string Value { get; set; }
// public object msg_arr { get; set; }
}
}
答案 0 :(得分:26)
这一行:
public object Hours { get; set; }}
你最后有}
答案 1 :(得分:5)
您在小时属性中有额外的括号;
public object Hours { get; set; }}
答案 2 :(得分:3)