i wrote a store procedure to update PAID field in tblUser, and that store proceudre works perfectly,
ALTER PROCEDURE [dbo].[submitPaypalPayment]
-- Add the parameters for the stored procedure here
@buyer_email varchar(50),
@payment bit
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
update tblUser set paid=@payment where email = @buyer_email
-- Insert statements for procedure here
END
but when i call it from my asp.net app then it doesn't update Paid field, eve i tried simpe update statement in my asp.net code but that also doesn't update the field.
String userEmail_send = (Convert.ToString(Request.QueryString["emailAdmin"]));
String conString = "Data Source=COSANOSTRA; MultipleActiveResultSets=true; Initial Catalog=Waleed_orsfinal;Integrated Security=True";
try
{
con.Open();
if (userEmail_get.Replace("'", string.Empty) == userEmail_send.Replace("''", string.Empty))
{
//String query1 = "update tblUser Set paid=1 where email='" + userEmail_send + "' ";
SqlCommand sqlcom1 = new SqlCommand("submitPaypalPayment", con);
sqlcom1.CommandType = CommandType.StoredProcedure;
sqlcom1.Parameters.Add("@buyer_email", SqlDbType.VarChar).Value = userEmail_send;
sqlcom1.Parameters.Add("@payment", SqlDbType.Bit).Value= 1 ;
sqlcom1.ExecuteScalar();
hdr_msg_success.InnerText = "Congrats, You have paid successfully. Wait for an approval by an admin ";
Response.Write("<br/>"+" "+ "Matched=" +userEmail_send.Replace("''","'"));
}
else
{
hdr_msg_success.InnerText = "Something went wrong in matching Emails , Please confirm your Email";
}
}
catch (Exception exc)
{
Response.Write(exc.Message);
}
finally
{
con.Close();
}
}
@ Sarathi125, thanks dearm but it is a longggg procedure, and i don't have enough time to solve it , so please help me if it has any syntax problem or something.
Hunain Hafee...
Member
238 Points
639 Posts
store procedure not working when called from asp.net
Jan 04, 2013 12:40 PM|LINK
i wrote a store procedure to update PAID field in tblUser, and that store proceudre works perfectly,
ALTER PROCEDURE [dbo].[submitPaypalPayment] -- Add the parameters for the stored procedure here @buyer_email varchar(50), @payment bit AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; update tblUser set paid=@payment where email = @buyer_email -- Insert statements for procedure here ENDbut when i call it from my asp.net app then it doesn't update Paid field, eve i tried simpe update statement in my asp.net code but that also doesn't update the field.
String userEmail_send = (Convert.ToString(Request.QueryString["emailAdmin"])); String conString = "Data Source=COSANOSTRA; MultipleActiveResultSets=true; Initial Catalog=Waleed_orsfinal;Integrated Security=True"; try { con.Open(); if (userEmail_get.Replace("'", string.Empty) == userEmail_send.Replace("''", string.Empty)) { //String query1 = "update tblUser Set paid=1 where email='" + userEmail_send + "' "; SqlCommand sqlcom1 = new SqlCommand("submitPaypalPayment", con); sqlcom1.CommandType = CommandType.StoredProcedure; sqlcom1.Parameters.Add("@buyer_email", SqlDbType.VarChar).Value = userEmail_send; sqlcom1.Parameters.Add("@payment", SqlDbType.Bit).Value= 1 ; sqlcom1.ExecuteScalar(); hdr_msg_success.InnerText = "Congrats, You have paid successfully. Wait for an approval by an admin "; Response.Write("<br/>"+" "+ "Matched=" +userEmail_send.Replace("''","'")); } else { hdr_msg_success.InnerText = "Something went wrong in matching Emails , Please confirm your Email"; } } catch (Exception exc) { Response.Write(exc.Message); } finally { con.Close(); } }help ?
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: store procedure not working when called from asp.net
Jan 04, 2013 12:45 PM|LINK
intercept query with SqlServer Profiler. See what you send for
Hunain Hafee...
Member
238 Points
639 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 12:47 PM|LINK
sorry sir, didn't get you, elaborate li'll please,
Hunain Hafee...
Member
238 Points
639 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 12:56 PM|LINK
? help please
sarathi125
Star
13599 Points
2691 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 01:12 PM|LINK
Hi,
Check this link
http://www.codeproject.com/Articles/21371/SQL-Server-Profiler-Step-by-Step
Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets
Hunain Hafee...
Member
238 Points
639 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 01:18 PM|LINK
@ Sarathi125, thanks dearm but it is a longggg procedure, and i don't have enough time to solve it , so please help me if it has any syntax problem or something.
Hunain Hafee...
Member
238 Points
639 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 01:33 PM|LINK
i tried session too
Hunain Hafee...
Member
238 Points
639 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 01:43 PM|LINK
?????????
Ramu Ajay
Member
623 Points
203 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 02:59 PM|LINK
For Quick, to Make sure connections are there. Write a select statement and see, If it works.
Do you get any Error?
or simply it doesnot do any thing and Is it going to IF Block?
Hunain Hafee...
Member
238 Points
639 Posts
Re: store procedure not working when called from asp.net
Jan 04, 2013 03:01 PM|LINK
connection works. and yes it gets to IF block, and the message which i embedded in IF block, WOrks and gets displayed but it isn't updating field.