Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

che3358

@che3358
About
Posts
10
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Useless for
    C che3358

    Do something absolutely is critical here to know whether it is horrible or not.

    The following sample indicates what you saw is not horrible:

    See, I have two controls: Label0 and TextBox1. I can assign values to them:

    for (int i = 0; i < 2; i++)
    {
    if (i == 0)
    {
    Label lable = (Label)this.FindControl("Label" + i.ToString());
    if (lable != null)
    lable.Text = "Test Label " + i.ToString();
    }

    if (i == 1)
    {
       TextBox txt = (TextBox)this.FindControl("TextBox" + i.ToString());
       if (txt != null)
         txt.Text = "Test TextBox " + i.ToString();
    }
    

    }

    See it? It is not a usual way, but, not as horrible as you saw.

    modified on Monday, March 2, 2009 4:04 PM

    The Weird and The Wonderful

  • Magic of if...else...programming
    C che3358

    I believe it will be another if...else IF the developer knew to deal with the DBNull issue that you mentioned. Now, how many ELSE he has? :)

    The Weird and The Wonderful

  • Magic of if...else...programming
    C che3358

    The following code was found in someone's web template. Hope you enjoy the best logic.

    if(dt != null)
    {
    if(dt.Rows.Count != 0)
    {
    if(dt.Rows[0]["Number"].ToString() == "1")
    {
    return true;
    }
    else
    {
    return false;
    }
    }
    else
    {
    return false;
    }
    }
    else
    {
    return false;
    }

    The Weird and The Wonderful

  • C# - Arrays vs Arraylist
    C che3358

    I believe he didn't learn any programming languages coverd Array before he jumped into Senior position of .NET

    The Weird and The Wonderful csharp ruby visual-studio data-structures performance

  • Why DataSet always returns null?
    C che3358

    His purpose was to clear object DataSet in section finally. But, do you guys think the DataSet will be cleared if no error is caught?

    private bool CheckData()
    {
    DataSet ds = null;
    try
    {
    //Get Data, and fill ds
    //if there is data in the ds's table
    return true;
    }
    catch{}
    finally
    {
    ds = null;
    }

    return false;
    

    }

    The Weird and The Wonderful help question

  • Why DataSet always returns null?
    C che3358

    Since some experienced programmers like Dan Neely didn't get humor feeling from my post, I do need to add the following words at the bottom of my post: (Hint: the programmer set ds = null in section finally before returning his ds)

    The Weird and The Wonderful help question

  • Why DataSet always returns null?
    C che3358

    You are as funny as the programmer. Did you think I am looking for help from you? Read my post again carefully please!

    The Weird and The Wonderful help question

  • Why DataSet always returns null?
    C che3358

    A programmer told me he just learned try...catch, and found it's very powerful. Later, he found one of his methods always return null after he implemented try...catch. Here is his code:

    private DataSet GetData()
    {
    DataSet ds = null;
    try
    {
    ds = new DataSet();
    //Get data
    //And assign ds = someData
    }
    catch
    {
    //Handle some error
    }
    finally
    {
    ds = null;
    }

     return ds;
    

    }

    The Weird and The Wonderful help question

  • Must love to run twice
    C che3358

    The following code I found some developer used very often. I just wonder might he loves to run getStatus twice to make sure his code executed perfect. if(GetStatus(id) != "") string status = GetStatus(id); private string GetStatus(int recordId) { string s = ""; //First, use ADO.NET to get the Status of this recordId //Then, assign the status to a string. if(//Check to make sure there is data and not DB null) s = //The data; //Finally, return the string return s; }

    The Weird and The Wonderful csharp database

  • if...AND...else! [modified]
    C che3358

    public bool CheckValue(int first, int second) { if(first > second) return true; else return false; } Folks like this way because it is better than the following way? return first > second;

    modified on Friday, May 30, 2008 1:36 PM

    The Weird and The Wonderful question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups