Showing posts with label breakpoint. Show all posts
Showing posts with label breakpoint. Show all posts

Saturday, March 24, 2012

Strange Error when executing a function

in my code-behind i call a class method that returns a string value...
i run step by step and works great!!

but when i run without breakpoint... sometimes i get error because my string is empty...
and then i run again step by step... and the surprise! works fine again...

why is this happening??

this is my code-behind

string param = " ";

param +=ConfigurarLoja.RetParams( );

Session.Add("ssnHabItemVincPromo",param);

if(param == " ")

{

response.redirect("~/Erro.aspx");

}

And this is my class method:

publicstaticstring RetParams()

{

string param ="";

int cd_empresa =Convert.ToInt32(HttpContext.Current.Session["ssnCdEmpresa"]);

string sql ="SELECT TOP 1 * FROM LjConfig WHERE cd_empresa = " + cd_empresa +" AND ISNULL(DATEADD(dd, 01, dt_exclusao), GETDATE()) > GETDATE() ORDER BY dt_inclusao DESC";SqlConnection con =newSqlConnection(ConfigurationManager.ConnectionStrings["StringDeConexao"].ConnectionString);

con.Open();

SqlCommand cmd =newSqlCommand(sql, con);

SqlDataReader dr = cmd.ExecuteReader();

dr.Read();

if (dr.HasRows)

{

param ="-" + dr["cd_empresa"].ToString().Trim();

}

con.Close();

return param;

}

ops... it seems solved...
i change the sql command 'WHERE'... i think it was a problem with the GETDATE... now its working fine...

AND (ISNULL(DATEADD(dd, 01, dt_exclusao), DATEADD(dd, 01, GETDATE())) > GETDATE()) "

Strange Error While Debugging

I put a break point in the Page_Load function but when I tell it to run
till breakpoint, a little question mark appears inside the breakpoint
stop sign and the popup says that the breakpoint will not be hit because
there are currently no symbols loaded for this document.

What does that mean? Why isn't it hitting a line of code inside the
Page_Load function?

JohnAre you running in debug mode?

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
"John Kraft" <jhkraft@.ilstu.edu> wrote in message
news:bhbh18$d8j$1@.malachite.ilstu.edu...
> I put a break point in the Page_Load function but when I tell it to run
> till breakpoint, a little question mark appears inside the breakpoint
> stop sign and the popup says that the breakpoint will not be hit because
> there are currently no symbols loaded for this document.
> What does that mean? Why isn't it hitting a line of code inside the
> Page_Load function?
> John
hi,

1) check Project properties -> Configuration properties -> Debugging ->
enable asp.net debugging is set to on.

2) check if Buid-> configuration manager -> active configuration set to
Debug.

3) sometimes error in the code can prevent from the debugger to reach
it. remark functions to check it out.

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!