Michael26's Profile User Rating: -----

Reputation: 353 Architect
Group:
Contributors
Active Posts:
1,511 (0.77 per day)
Joined:
08-April 09
Profile Views:
33,790
Last Active:
User is offline Today, 06:41 AM
Currently:
Offline

Previous Fields

Country:
YU
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
25

Latest Visitors

Icon   Michael26 I'm never wrong, i thought i was wrong once but i was wrong

Posts I've Made

  1. In Topic: What are you working on today?

    Posted 20 Aug 2014

    "Crack open a cold one" :)
    Life must be fun working in the morgue, huh?
  2. In Topic: Well...

    Posted 13 Aug 2014

    I don't really know you, but it's good you're back :)
  3. In Topic: Connection to SQL Database. Needs initializing

    Posted 8 Aug 2014

    ExecuteNonQuery method executes the query and returns the number of rows affected, judging from the return type of your method you want to return number of the affected rows in that case it should be
    int RowsAffected = cmd.ExecuteNonQuery();
    return RowsAffected;
    


    As for connection string i would keep that in app.config or web.config file and not in the code.
    If you want your connection to persist in your instance i think you should implement the singleton pattern

    I think the reason you are getting that error is because your SqlConnection only lives inside the connectiontoSQL method, once you leave that method your connection is gone, it's about the scope of your method.
  4. In Topic: Unknown problem with array

    Posted 7 Aug 2014

    Post the code here for future reference

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace vezba
    {
        class SomeRandomArray
        {
            int[] SomeArray = new int[10]; // Array for testing
    
                //Get integer and put them into array
            public void GetArray()
            {
                short n;
                Console.WriteLine("How many numbers you would like to enter(MAX 10)");
                n = Convert.ToInt16(Console.ReadLine());
                Console.WriteLine("Please enter your numbers:");
                for (int i = 0; i < n; i++) SomeArray[i] = Convert.ToInt32(Console.ReadLine());
                }
              //Find Maximum value in Array
         public int FindMax() {
             int max = SomeArray[0];
             for (int i = 1; i < SomeArray.Length; i++)
             {
                 if (max < SomeArray[i]) max = SomeArray[i];
             }
                 return max;
         }
               //Find Minimum value in Array
         public int FindMin()
         {
             int min = SomeArray[0];
             for (int i = 1; i < SomeArray.Length; i++)
             {
                 if (min > SomeArray[i]) min = SomeArray[i];
             }
             return min;
         }
                //Find if there is any zero in array
         public bool FindZero()
         {
             int i = 0;
            bool isZero = false;
            do
            {
                if (SomeArray[i] == 0)
                {
                    isZero = true;
                }
                i++;
            } while (isZero == false);
            return isZero;
         }
            static void Main(string[] args)
            {
                int MAX, MIN;
                bool ZERO;
                SomeRandomArray NewObject = new SomeRandomArray();
                NewObject.GetArray();
                MAX = NewObject.FindMax();
                MIN = NewObject.FindMin();
                ZERO = NewObject.FindZero();
                Console.WriteLine("\nYour Maximum value is: {0}\nYour Minimum value is:{1}");
                if (ZERO == true)
                {
                    Console.Write("Your Array has at least one zero.");
                }
                else if (ZERO == false)
                {
                    Console.Write("Your Array doesn't have zero within.");
                }
                Console.ReadLine();
            }
        }
    }
    
  5. In Topic: Secure Database System

    Posted 2 Aug 2014

    What is not working?
    ExecuteNonQuery method returns number of rows affected, so if do this
    in rowsAffected = command.ExecuteNonQuery();
    
    and print the value of rowsAffected you'll see how many rows where, in your case, inserted into the database table.

My Information

Member Title:
DIC-head, major DIC-head
Age:
31 years old
Birthday:
May 15, 1983
Gender:
Location:
Belgrade, Serbia
Years Programming:
6
Programming Languages:
C#, T-SQL, OOP, UML, XML(beginner) , WPF, VB.NET, Java.

Contact Information

E-mail:
Private
Website URL:
Website URL  http://michael-csharp.blogspot.com/
Twitter:
Mitche2600

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    rossypz Icon

    15 Aug 2014 - 01:40
    i will wait to read from u
  2. Photo

    rossypz Icon

    15 Aug 2014 - 01:30
    Hi,I Am Mrs Rose.I am writing to know you more for i have an important issue to discuss with you. for more details write me on This Email: rosse4u2006@hotmail.com wrte to my email..
    God bless.
    Roseline
  3. Photo

    tarmizi_adam2005 Icon

    18 May 2014 - 16:32
    the "Latest Visitor" thingy shows you...
    well I welcome your visit. Haha !
  4. Photo

    tarmizi_adam2005 Icon

    02 Jan 2014 - 08:43
    Hello
  5. Photo

    BenignDesign Icon

    13 Dec 2013 - 09:33
    You believe what you want. I'll believe what I want. :P
  6. Photo

    BenignDesign Icon

    13 Dec 2013 - 07:24
    You've been here for four years and are still questioning whether or not I have a potty mouth? Methinks you haven't been paying attention.
  7. Photo

    ChrisNt Icon

    10 Dec 2013 - 05:52
    :)
  8. Photo

    Michael26 Icon

    14 Oct 2013 - 05:01
    1,000 Active posts.
  9. Photo

    Michael26 Icon

    26 Sep 2013 - 11:10
    Reputation -> 200
  10. Photo

    Michael26 Icon

    11 Jul 2013 - 12:17
    I have stepped into 3 digit reputation.
  11. Photo

    Michael26 Icon

    25 Jun 2013 - 10:33
    Post the question in the appropriate forum with the code you've tried so far.
  12. Photo

    senthilandhamodaran Icon

    25 Jun 2013 - 06:36
    i need time table generator code in c#
  13. Photo

    BenignDesign Icon

    19 May 2013 - 11:29
    Thanks, Kilroy.
  14. Photo

    Michael26 Icon

    22 Apr 2013 - 08:49
    Reputation 50 :)
  15. Photo

    Michael26 Icon

    28 Mar 2013 - 12:50
    My reputation is 42 :)
  • (2 Pages)
  • +
  • 1
  • 2