private void update()
Int64 sum = 0;
sum = (!string.IsNullOrEmpty(Request.QueryString["Id"])) ? Int64.Parse(Request.QueryString["Id"]) : 0;
if (sum != 0) - Here in Debug mode, i get this condition is false and equals 0
{
var context = new myDatabase();
var s = context.myTableName.FirstOrDefault(c => c.Id == sum);
if (s!= null && s.Id > 0)
{
if (!String.IsNullOrEmpty(myTextBoxId.Text))
{
MyUpdateMethod(sum,Decimal.Parse(myTextBoxId.Text));
}
}
else
{
if (!String.IsNullOrEmpty(myTextBoxId.Text))
{
MyInsertMethod(sum, Decimal.Parse(myTextBoxId.Text));
}
}
Dear Friends,
I just want a if else condition to update (in if) and insert (in else) my Database table. But Using above condition, my Table only get Inserted and updates doesn't work. What's wrong in my code. Assigning null to my variable is correct? Pls do your help for me.
Thanks in advance
Anonymous3 0 Newbie Poster
Ketsuekiame 860 Master Poster Featured Poster
lolafuertes 145 Master Poster
Anonymous3 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.