ユーザーがボタンをクリックするたびに入力が追加されるデータグリッドで表示したい..それを行うにはどうすればよいですか..データベースに保存できるようになりました...しかし、ユーザーがデータの追加をクリックするたびにデータベースに保存され、フロントエンドでデータグリッド形式で表示されるデータグリッド順のインターフェイス自体..TQ
protected void Button2_Click(object sender, EventArgs e)
{
if (Session["Time"].ToString() == ViewState["Time"].ToString())
{
SqlConnection connection = new SqlConnection("Data Source=RGUNASEL- DESK\\SQLEXPRESS;Initial Catalog=eLogbook;User ID=sa;Password=1234");
connection.Open();
SqlCommand cmd = new SqlCommand("eform2", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@lot_num", SqlDbType.VarChar, 50)).Value = TextBox8.Text;
cmd.Parameters.Add(new SqlParameter("@location", SqlDbType.VarChar, 50)).Value = TextBox9.Text;
cmd.Parameters.Add(new SqlParameter("@total_in", SqlDbType.VarChar)).Value = TextBox10.Text;
cmd.Parameters.Add(new SqlParameter("@first_test", SqlDbType.VarChar, 50)).Value = TextBox11.Text;
cmd.Parameters.Add(new SqlParameter("@second_test", SqlDbType.VarChar)).Value = TextBox12.Text;
cmd.Parameters.Add(new SqlParameter("@third_test", SqlDbType.VarChar, 50)).Value = TextBox13.Text;
cmd.Parameters.Add(new SqlParameter("@total_out", SqlDbType.VarChar, 50)).Value = TextBox14.Text;
cmd.Parameters.Add(new SqlParameter("@lot_status", SqlDbType.VarChar, 50)).Value = TextBox17.Text;
cmd.Parameters.Add(new SqlParameter("@remark", SqlDbType.VarChar, 50)).Value = TextBox16.Text;
cmd.ExecuteNonQuery();
Response.Write("Submitted!");
TextBox8.Text = null;
TextBox9.Text = null;
TextBox10.Text = null;
TextBox11.Text = null;
TextBox12.Text = null;
TextBox13.Text = null;
TextBox14.Text = null;
TextBox17.Text = null;
TextBox16.Text = null;
Session["Time"] = DateTime.Now.ToString();
}
else
{
// Code for page refresh....
TextBox8.Text = null;
TextBox9.Text = null;
TextBox10.Text = null;
TextBox11.Text = null;
TextBox12.Text = null;
TextBox13.Text = null;
TextBox14.Text = null;
TextBox17.Text = null;
TextBox16.Text = null;
Response.Write("Page Refreshed!");
}
}