دیتابیس اکسس
میخوام در جدول ذگر شده بعد از جستچو بیشترین عدد پیدا بشه و توی تکس باکس نشون داده بشه.
لطفا کد زیر را برام اصلاح کنید.
با تشکر
DataTable dtResult1 = new System.Data.DataTable(); string SIDE_Name;
SIDE_Name = side.Text;
if (SIDE_Name == "ماشین")
{
SIDE_Name = "Pusher";
}
if (SIDE_Name == "کک")
{
SIDE_Name = "Coke";
}
command.Remove(0, command.Length);
command.Append("select MAX(WenDu) from tb_ZhiXingInfoDetail where ");
if (cell.Text != string.Empty)
command.Append("rssId = @rssId AND ");
if (block.Text != string.Empty)
command.Append("jiaoluhao = @jiaoluhao and ");
if (label10.Text != string.Empty)
command.Append("jiaolutype = @jiaolutype and ");
if (date1.Text != "")
command.Append("inputDate >= @inputDate and ");
if (date2.Text != "")
command.Append("inputDate <= @inputDate1 and ");
command.Append("1 = 1");
cmd.CommandText = command.ToString();
cmd.Connection = con;
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@rssId", cell.Text);
cmd.Parameters.AddWithValue("@jiaoluhao", block.Text);
cmd.Parameters.AddWithValue("@jiaolutype", label10.Text);
cmd.Parameters.AddWithValue("@inputDate", date1.Text.ToString());
cmd.Parameters.AddWithValue("@inputDate1", date2.Text.ToString());
dtResult1.Clear();
da = new OleDbDataAdapter(cmd);
da.Fill(dtResult1);
maxtxt.Text = dtResult1.ToString();