Hi
I designed a stored procedure execute by aspx side to disable an old published jobs which have date expired by button click.
stored procedure code:
- CREATE PROCEDURE [dbo].[get_expir_job_date]
- @C_date datetime,
- @JEnable bit
-
-
- AS
- BEGIN
- IF @C_date != Null
- BEGIN
- SELECT @C_date FROM [Jobs]
-
- if @C_date > DATEADD(DAY, +30, CURRENT_TIMESTAMP)
- exec get_expir_job_date 'UPDATE Jobs SET "@JEnable=False" ';
-
- END
- RETURN
- END
C# button code:
- protected void SChJ_Click(object sender, EventArgs e)
- {
- string connectionString = @"Data Source=(local)\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbCh.mdf;Integrated Security=True";
- using (SqlConnection sqlcon = new SqlConnection(connectionString))
- {
- try
- {
- SqlCommand sqlcmd = new SqlCommand("get_expir_job_date", sqlcon);
- sqlcmd.CommandType = CommandType.StoredProcedure;
- sqlcmd.Parameters.AddWithValue("@C_date", SqlDbType.DateTime);
- sqlcmd.Parameters.AddWithValue("@JEnable", SqlDbType.Bit);
- sqlcon.Open();
- sqlcmd.ExecuteNonQuery();
- sqlcon.Close();
- }
- catch (Exception ex)
- {
-
- JobFaUp.Text = ex.ToString();
- }
-
- }
- }
Actually, nothing affects on rows.
So what's the wrong, I don't know?
Thanks