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
38.1k
What's wrong in that stored procedure
Jun 27 2020 10:45 AM
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
-- NULL is the default value.
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
Reply
Answers (
2
)
Using Abtract Classes and Inheritance to create a shopping cart in MVC
About CheckboxList in MVC