TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aktham Mahmoud
NA
720
37.5k
Why stored procedure not working by button
Sep 11 2020 6:03 PM
Greeting
I created a button, when an Admin click on it call stored procedure to do this step:
===> Modify Column value [Bit] from true to False when a records came old than 30 days.
What happen?
when I click on button a page refresh, but a rows in table not modfiy ( change column value)
Button code:
protected
void
SChJ_Click(
object
sender, EventArgs e)
{
string
connectionString = @
"Data Source=(local)\SQLEXPRESS;AttachDbFilename=|DataDirectory|\land.mdf;Integrated Security=True"
;
using
(SqlConnection sqlcon =
new
SqlConnection(connectionString))
{
try
{
sqlcon.Open();
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);
sqlcmd.ExecuteNonQuery();
sqlcon.Close();
}
catch
(Exception ex)
{
JobFaUp.Text = ex.ToString();
}
}
}
Stored Procedure Code
CREATE
PROCEDURE
[dbo].[get_expir_job_date]
@C_date datetime, //Create Date
@JEnable
bit
//JOb Status Enable or Disable
AS
BEGIN
SELECT
*
FROM
[Jobs]
Update
[Jobs]
SET
@JEnable=
'False'
WHERE
@C_date > DATEADD(
DAY
, +30,
CURRENT_TIMESTAMP
)
End
Reply
Answers (
4
)
Regular expression expression modification required
GridView Is not firing onrowcommand for checkbox please help