protected string showInfo(int id)
{
if (id = null)
{
string sql = "select top 5 * from context";
}
else
{
sql = "select top 5 * from context where listid=" + id + "";
}
string tbody = "";
OleDbDataReader my_reader;
OleDbCommand my_comm = new OleDbCommand();
my_comm.CommandText= sql;
my_comm.CommandType = CommandType.Text;
my_comm.Connection = my_conn;
my_conn.Open();
my_reader = my_comm.ExecuteReader();
}
我知道是if语句的问题,但不知道怎么修改?望高手指点,谢谢!!
{
if (id = null)
{
string sql = "select top 5 * from context";
}
else
{
sql = "select top 5 * from context where listid=" + id + "";
}
string tbody = "";
OleDbDataReader my_reader;
OleDbCommand my_comm = new OleDbCommand();
my_comm.CommandText= sql;
my_comm.CommandType = CommandType.Text;
my_comm.Connection = my_conn;
my_conn.Open();
my_reader = my_comm.ExecuteReader();
}
我知道是if语句的问题,但不知道怎么修改?望高手指点,谢谢!!
if (id = null)
{
sql = "select top 5 * from context";
}
else
{
sql = "select top 5 * from context where listid=" + id + "";
} 如果id为负?没写完写全吧?
没有返回值
my_conn没有关闭变量名称规范规定是什么来着?