62,046
社区成员
发帖
与我相关
我的任务
分享
protected void Getdatabind()
{
Sda.SelectCommand = new SqlCommand();
Sda.SelectCommand.CommandTimeout = 180;
Sda.SelectCommand.Connection = con;
Sda.SelectCommand.CommandText = "LOTNO1";
Sda.SelectCommand.CommandType = CommandType.StoredProcedure;
Sda.SelectCommand.Parameters.Add(new SqlParameter("@FDATE", SqlDbType.Char)).Value = TxtDate.Text;
Sda.SelectCommand.Parameters.Add(new SqlParameter("@Class", SqlDbType.NVarChar)).Value = DDLClass.SelectedValue.Trim();
if (con.State.ToString() == "Closed")
con.Open();
Sda.Fill(Ds, "QTYLOT");
GridView1.DataSource = Ds.Tables["QTYLOT"].DefaultView;
GridView1.DataBind();
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
Sda.DeleteCommand = new SqlCommand();
Sda.DeleteCommand .Connection = con;
Sda.DeleteCommand .CommandType = CommandType.Text;
Sda.DeleteCommand .CommandText = "DELETE FROM ITEM WHERE LOTNO='" + txtlot.Text + "' ";
if (con.State.ToString() == "Closed")
con.Open();
//SqlDataReader sdr = Sda.DeleteCommand.ExecuteReader();
int p = Sda.DeleteCommand.ExecuteNonQuery();
//GridView1.DataSource = sdr;
//GridView1.DataBind();
con.Close();
if (txtlot.Text != "")
{
labAlert.Visible = true;
GridView1.Visible = false;
txtlot.Text = "";
}
//else
//{
//}
}
public partial class LotNo1 : System.Web.UI.Page
{
private SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Con"]);
private SqlDataAdapter Sda = new SqlDataAdapter();
private DataSet Ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DateTime td = DateTime.Now;
string strMonth = "";
string strDay = "";
if (td.Month.ToString().Length < 2)
strMonth = "0" + td.Month.ToString();
else
strMonth = td.Month.ToString();
if (td.Day.ToString().Length < 2)
strDay = "0" + td.Day.ToString();
else
strDay = td.Day.ToString();
TxtDate.Text = td.Year.ToString() + "/" + strMonth + "/" + strDay;
TxtDate.Attributes.Add("onclick", "fPopCalendar(this)");
BindClass();
//Getdatabind();
}
}
private void BindClass()
{
DDLClass.Items.Clear();
ListItem lld_1 = new ListItem();
lld_1.Text = "全部";
lld_1.Value = "";
DDLClass.Items.Add(lld_1);
ListItem lld_2 = new ListItem();
lld_2.Text = "A";
lld_2.Value = "A";
DDLClass.Items.Add(lld_2);
ListItem lld_3 = new ListItem();
lld_3.Text = "B";
lld_3.Value = "B";
DDLClass.Items.Add(lld_3);
ListItem lld_4 = new ListItem();
lld_4.Text = "C";
lld_4.Value = "C";
DDLClass.Items.Add(lld_4);
}
protected void Getdatabind()
{
Sda.SelectCommand = new SqlCommand();
Sda.SelectCommand.CommandTimeout = 180;
Sda.SelectCommand.Connection = con;
Sda.SelectCommand.CommandText = "LOTNO1";
Sda.SelectCommand.CommandType = CommandType.StoredProcedure;
Sda.SelectCommand.Parameters.Add(new SqlParameter("@FDATE", SqlDbType.Char)).Value = TxtDate.Text;
Sda.SelectCommand.Parameters.Add(new SqlParameter("@Class", SqlDbType.NVarChar)).Value = DDLClass.SelectedValue.Trim();
if (con.State.ToString() == "Closed")
con.Open();
Sda.Fill(Ds, "QTYLOT");
GridView1.DataSource = Ds.Tables["QTYLOT"].DefaultView;
GridView1.DataBind();
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
Sda.DeleteCommand = new SqlCommand();
Sda.DeleteCommand .Connection = con;
Sda.DeleteCommand .CommandType = CommandType.Text;
Sda.DeleteCommand .CommandText = "DELETE FROM ITEM WHERE LOTNO='" + txtlot.Text + "' ";
if (con.State.ToString() == "Closed")
con.Open();
//SqlDataReader sdr = Sda.DeleteCommand.ExecuteReader();
int p = Sda.DeleteCommand.ExecuteNonQuery();
//GridView1.DataSource = sdr;
//GridView1.DataBind();
con.Close();
if (txtlot.Text != "")
{
labAlert.Visible = true;
GridView1.Visible = false;
txtlot.Text = "";
}
//else
//{
//}
Getdatabind();
}
protected void Button1_Click(object sender, EventArgs e)
{
Getdatabind();
}
}