“Load”方法没有采用“4”个参数的重载
急的哈!!!!!!1
public DataTable Load(string connStr,int ClassID,int maxCount,int Abc)
{
//??????
SqlConnection cnn;
SqlCommand cmd;
SqlDataAdapter dap;
DataSet dst;
//?????
cnn = new SqlConnection(connStr);
dst = new DataSet();
if (ClassID==0)
{
if (maxCount==0)
{
cmd = new SqlCommand( "select ID,classID, " + Convert.ToString( "Title ").Substring(1, Abc) + ",UpdateTime from News order by UpdateTime desc ", cnn);
}
else
{
cmd = new SqlCommand( "select top " + maxCount.ToString() + " * from News ",cnn);
}
}
else
{
if (maxCount==0)
{
cmd = new SqlCommand( "select * from News where [ClassID]= " + ClassID.ToString() + " ",cnn);
}
else
{
cmd = new SqlCommand( "select top " + maxCount.ToString() + " * from News where [ClassID]= " + ClassID.ToString() + " ",cnn);
}
}
dap = new SqlDataAdapter(cmd);
dap.Fill(dst, "News ");
cnn.Close(); //?????
//????
return dst.Tables[ "News "];
}
我是一个初学者,请问各位这是怎么回事情出现错 “Load”方法没有采用“4”个参数的重载
------解决方案--------------------跟这段代码没关系,而是你调用的时候参数写错了.