I searched the internet, all the previous answers said that there is no semicolon. It's not a problem. What else could cause this error? On the third site, several people asked this question, but this scenario is different.
Error> Definition of type or namespace, or end of file expect d
public partial class SeenSMS : System.Web.UI.UserControl
{
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(reader["count"]);
}
}
else{
}
}
}
{
}
}
}
}
public bool number { get; set; }
public object Hours { get; set; }}
}
}
source
share