autocode generate with the help of name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • abneeshupadhyay
    New Member
    • Feb 2010
    • 1

    autocode generate with the help of name

    Code:
    x = new OracleConnection("Data Source=cstr;Persist Security info=true;user id=dispatch;password=dispatch;unicode=true");
                x.Open();
                string p;
                string q;
                string st1 = textBox3.Text + "%";
                y = new OracleCommand("select CUST_CODE from CUST_ADD where substr(CUST_NAME,0,1) like '" + st1 + "'", x);
                q = y.CommandText;
    
                z = y.ExecuteReader();
    
    
                int r;
                y = new OracleCommand("select NVL(MAX(to_number(substr(CUST_CODE,2,3))),0)+1 from CUST_ADD where substr(CUST_CODE,0,1) like '" + st1 + "'", x);
              
                r = y.GetHashCode();
                z = y.ExecuteReader();
             
    
                if (z.HasRows)
                {
                    if (z.Read())
                    {
    
                        if (r <= 9)
                        {
                            p = q + "00" + r ;
                            textBox1.Text = p;
                            textBox1.Text = z[0].ToString();
                        }
    
                        else if (r <= 99)
                        {
                            p = q + "0" + r;
                            textBox1.Text = p;
                            textBox1.Text = z[0].ToString();
                        }
                        else
                        {
                            p = q + r;
                            textBox1.Text = p;
                            textBox1.Text = z[0].ToString();
                        }
    
                    }
    
                }
             
                //z.Dispose();
                y.Dispose();
                x.Close();



    PLZ SEE THIS CODE AND IF ANY ERROR THAN PLEASE HELP ME
    Last edited by tlhintoq; Feb 26 '10, 02:38 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    What is the problem that you're facing with this code?

    Comment

    • ThatThatGuy
      Recognized Expert Contributor
      • Jul 2009
      • 453

      #3
      You should check it... if there are any errors.... you'll receive compiler complaints immediately.... on program compilation

      Comment

      • semomaniz
        Recognized Expert New Member
        • Oct 2007
        • 210

        #4
        Please do not double post the question.

        Original Post http://bytes.com/topic/c-sharp/answe...rate-help-name

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
          #

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            PLZ SEE THIS CODE AND IF ANY ERROR THAN PLEASE HELP ME
            So you don't even know if there is a problem? You just want other people to do your debugging for you?

            When you *know* you have a problem... and you have made an actual effort of your own to resolve it... Post the relevant code along with the error message and what you have done to try to resolve it.

            Comment

            Working...