ChrisHunter 152 Posting Whiz in Training Featured Poster

Where does the age of the employee come from is it calculated using their DOB? use the GROUPBY clause to group the employees by age

ChrisHunter 152 Posting Whiz in Training Featured Poster

It's a joke about men... thinking its a sprint and not a marathon...

ChrisHunter 152 Posting Whiz in Training Featured Poster

I read somewhere that the chicken evolved from a T-rex... don't know how true this is, if it is true it's quite ironic.

http://www.dailymail.co.uk/sciencetech/article-448283/Proof-fearsome-T-Rex-evolved-chicken.html

ChrisHunter 152 Posting Whiz in Training Featured Poster

I'm a fairly new developer and think windows is easy to use but I've grown up with windows machines. That might be the case had I always used mac os though.

BigPaw there is a Win8 camp in Manchester this Sunday (25th) and two in London on 30th and 1st. Even though I'm quite inexperienced, if I didnt already have plans I would have gone to the one London on 1st Dec (even).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi Howard, I'm not sure what you're asking for.

  • Have you created a windows form using code?
  • Do you want to create this textbox before the appliction is run?
ChrisHunter 152 Posting Whiz in Training Featured Poster

Have a look at This its the MSDN website with examples of how the different types are used.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Start simple with a cumputerised address book or something similar and work up to a library system and the likes.

There is a book called 'Head First C#' that is a more hands on book which has you developing application that grow in complexity as you read on.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Yeah just like that but you only really need to define "SQL sql;" once at the top and then just do the "sql = new SQL();" as the first line of each method (it's not essential but it's good practise to re-use variables in this way).

ChrisHunter 152 Posting Whiz in Training Featured Poster

As good practise you should have a class seperate from your interface methods (i.e. button clicks) so that they aren't as accessible and to organise your application better. Simply make another class with the connection and insert command in and simply call that from the button click events.

ChrisHunter 152 Posting Whiz in Training Featured Poster

put a curly bracket before the break keyword.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It looks like it's the foreach close bracket...

Keep the positioning of your curly brackets the same, make its more readable and consistant (you have some on new lines and some at the end of lines).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Click your name next to "Logged in as", scroll to the bottom and click "Edit Username".

ChrisHunter 152 Posting Whiz in Training Featured Poster

good for you...

ChrisHunter 152 Posting Whiz in Training Featured Poster

Tried Form1.Refresh() that might do the job

ChrisHunter 152 Posting Whiz in Training Featured Poster

Put AS after the brackets and before Subscribed_to_Business_XL see if that works.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I would suggest that you don't databind objects like comboBoxes and textBoxes because it means your program will be less flexible, I tried (or think i did) something similar to what you're doing and found databinding object meant i couldn't add particular functionality i wanted. If you databind an object rather than writing seperate methods for the occurence of particular event (in you case one event for when a record is clicked in the main form and a seperate method for when a record is clicked in the subform) your code may become messy and less managable.

More to the point of your issue I used this line of code to retrieve data from a spacific cell within a spacific row of the DGV and set it to a textBox:

textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

if you're creating a new database it is just added to the list that master is in e.g. the list would read:
-collegeDB
-master
-myDB1

if you want to move all data from one DB to another you may have to bulk move everything over in an SQL statement. If you have the SQL script that creates the DB that contains the data you want too move over, simply alter the "CREATE DATABASE DBName;" statement.

ChrisHunter 152 Posting Whiz in Training Featured Poster

can you not give the <p> tag an ID attribute and then use that ID to reference the text attribute of the <p> tag ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi bhaga,

I tried to do something similar in the past but could only manage to get the windows identity of the current windows user and not the password. It might be better security purposes to get the user to create a new password different to the one they use to log into their work station.

to get the windows identity i did this:

WindowsIdentity.GetCurrent().Name.ToString();

then simply stored it in a users table in the SQL server DB with the password entered by the user on a registration form.

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you create a connection sting for your database in app.Config, create a method called something like DBConnect() and then call that in you SQL command then you won't need to data your database name in you SQL statement. The issue i'm guessing is with:

(1,@data) ; "

Make sure the datatype of the data you're trying to store is compatable with the datatypes of the columns in your DB

ChrisHunter 152 Posting Whiz in Training Featured Poster

You should have all patients in a single table with a unique ID for each patient and then seperate tables (in-patient and out-patient) that reference the patient's record from the main patient table.

Unfortunatly other than the below query (which will return all rows from both tables and show which will show both matched and unmatched patient records) i don't know the query to fix the issue correctly.

SELECT OP.PatientID IP.PatientID OP.PatientFName, OP.PatientLName, OP.Gender
FROM OutpatientDetails AS OP
FULL OUTER JOIN InpaitentDetails AS IP
ON OP.PatientFName = IP.PatientFName 
AND OP.PatientLName = IP.PatientLName 
AND OP.Gender = IP.Gender;

Hope this helps, let me know how it goes . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

This should do i i think, let me know if it works or not.

SELECT INP1.PatientID, PatientFName, PatientName, Gender
FROM INP1 LEFT JOIN OTP1
ON
INP1.PatientID = OTP1.PatientID;

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you're using Windows you can just go to Start->Search and then start to enter the name of your program. to get the .exe you need to publish your program and save the published version to your desktop.

Hope this helps . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

I think I would ditch the auto and ride a bike. That's terrible price for petro.

I'm thinking of investing in a motorbike, more expencive than a bicycle but cheaper than a car (which is £2000 for insurance per year).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Don't get me started of petrol prices in the UK ! I'm spending £60-£70 on the stuff in an average week at the moment.

The tanker drivers are planning on going on strike in a weeks time too so it's going to be like something out of a Mad Max film at the pumps this time next week !

ChrisHunter 152 Posting Whiz in Training Featured Poster

Is COTDetails a column in a table ? if so do the following for where clause:

WHERE COTDetails NOT BETWEEN '32' AND '63';

This works for me when selecting customers using their ID column.

Also don't forget to put " " on each end of your SQL statement.

ChrisHunter 152 Posting Whiz in Training Featured Poster

As NormR1 said you don't appear to call the getNumDots() method. Also why are you returning value in getNumDots() when you haven't done anything with value in that method. Other than that your methods look ok you just need to call them at some point.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have a look at this Click Here.

Also do WANT to select COTDetails that are NULL or that are NOT NULL ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

To answer your first question: No they are assigned different IP addresses. 192.168.0.1 is usually the default IP and is usually reserved for a router, the first computer connected to the router will have an IP of 192.168.0.1, the second 192.168.0.2 and i think you can guess the 3rd.

to question 2: i think you can set the IP of the web server but if you're renting one you will be given the IP i think.

to answer question 3: if external users (people not connected to your network) use the website they will access your website by typing in the website URL which references the DNS to get the IP of your webserver where the data for website is stored.

Hope this helps . . .

My answer may not be 100% correct, check other replys to confirm

ChrisHunter 152 Posting Whiz in Training Featured Poster

I don't know much Java but by the looks of the error you're getting it looks like the ClassicRoom.Occupy field should never be null but is null at the point the error is thrown.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It depends on what the database will be used to ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

This works i've tried and tested it, just put your directory in, call the method in the constructor or where ever you want and you will be good to go. (it shows the whole directors as well as the name, i don't know how to just return the name sorry).

private void locatetFiles()
        {
            listBox1.Items.Clear();

            try
            {
                foreach (string file in Directory.GetFiles(@"C:\Users\user_name\Pictures", "*.jpg", SearchOption.AllDirectories))
                {   
                    listBox1.Items.Add(file);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("" + e);
            }
        }

Let me know how you get on.

ChrisHunter 152 Posting Whiz in Training Featured Poster

try this, it worked for me but i was looking for all Xml file names and used a comboBox instead of a listBox (i've used your directory in the example).

private void locatetFiles()
        {
            ListBox1.Items.Clear();

            try
            {
                foreach (string file in Directory.GetFiles(@"C:\Users\James\Pictures\", "*.jpg", SearchOption.AllDirectories))
                {
                    ListBox1.Items.Add(file);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("" + e);
            }
        }

Hope this is better for you.

ChrisHunter 152 Posting Whiz in Training Featured Poster

i've only ever used a backend database to populate a list box but i don't know about the "Directory.GetFiles(@"C:\Users\James\Pictures\", "*.jpg").ToList();" part, but to put the names in the list box try this (the foreach section)

private void popListBox()
        {
            try
            {
                List<string> imgNames = Directory.GetFiles(@"C:\Users\James\Pictures\", "*.jpg").ToList();

                foreach (string str in imgNames )
                {
                    //Adds new item to listBox1 foreach item in sting list
                    listBox1.Items.Add(str);
                }
            }
            catch
            {
            }
        }

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Do NOT assume anything about a user. Users tend to know what you assumed about them and are going to do the exact opposite.

Do NOT assume anything about a user. Users tend to know what you assumed about them and are going to do the exact opposite.

Too true !

I'd go with the label option with it reading something along the lines of "please ensure all fields are completed before proceeding" of "please complete highlighted fields before proceeding", make it red, turn the opacity down so it isn't too harsh on the eyes and place it above all the radiobuttons and text fields.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have you tried:

string variableName;

And using this in-line:

'" + variableName + "'
ChrisHunter 152 Posting Whiz in Training Featured Poster

As kamilacbe said you need to use execute reader, your code should be something like this, try to understand it and change it to suit:

public List<string> getName()
        {
            //SQL statement to select Name from MyTable
            string sql = "SELECT Name FROM Mytable.Name";
	    
           //SQL command establishes database connection and executes SQL command
            SqlCommand cmd = new SqlCommand(sql, db.MyDBConnectMethod());

            //Creates list of strings
            List<string> NameList = new List<string>();

            try
            {
                //Creates SQLdatareader
                SqlDataReader rdr;

                //Reads the result of cmd 
                rdr = cmd.ExecuteReader();

                //Executes contents while there is data to available to read
                while (rdr.Read())
                {
                    //Adds each name read to a list of strings
                    NaameList.Add(rdr["Name"].ToString());
                }
                //Closes reader
                rdr.Close();
            }
            //Executed if try cannot
            catch
            {
            }
            //Returns string list
            return NameList;
}
ChrisHunter 152 Posting Whiz in Training Featured Poster

I've got a Dell XPS M1530 and having a problem with the battery too. It was so bad that i had to have the charger in at all times but now it will only turn on if i leave the charger in but take the battery out so that it's running straight off the mains, the laptop wasn't even 2 years old when it started, either i had a dodgy battery or dell's batteries are rubbish !

Anyone know where i can get a new one (apart from dell they cost well over £100 which is extortionate and probably more than the laptop is worth now).

ChrisHunter 152 Posting Whiz in Training Featured Poster

The example you've given is fine and won't cause any problems because you've used return which will jump out of the method from that return keyword.

If you didn't have the return or break key word and just had some code like set a bool variable to true then it would continue executing the code after the if statement once the if statement is complete.

hope this helps . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

i was suggesting a solution that uses arrays to store user details but if you're using a a database that will be easier.

If i understand you correctly you want a different form to be loaded depending on the type of user that logs in (engineer, supervisor, manager). Simply add a column to the user table to store the different types of user and then during the check to see if the user exists simply check whether they are a manager, supervisor or engineer and load the appropriate form.

ChrisHunter 152 Posting Whiz in Training Featured Poster

If your're storing the user details in arrays you can add an int field to the array called somethin like AuthLevel and use 1, 2 or 3 as the different roles. One logging in you would do a check to see if the user exists and depending on the value of that user's AuthLevel field.

If your using an connected database it would be easier, especially if your going to be storing data entered into the different forms.

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

I would suggest doing it the way thines01 has suggested. Take a look at this. there's plenty of examples floating about just do a quick search and you'll find them.

ChrisHunter 152 Posting Whiz in Training Featured Poster

do you mean you tried to up vote the same post more than one ? or multiple posts in the same thread ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

it's ok, when your doing the system designs you want to make sure you've got a full set of reqirements before you start creating UML diagrams. You should create the UML diagrams in an order too starting with UseCase diagrams, sequence diagrams, package diagrams and then class diagrams.

These are the only diagrams i've had experience with so there may be others that i haven't mentioned above that may be appropriate for your work.

ChrisHunter 152 Posting Whiz in Training Featured Poster

If i understand correctly you're talking about processes that don't need user input. Have a look into sequence diagrams, they are created to show the different steps of an individual (e.g. request bank statement) this link might be of use to you.

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I did something very similar were i exported the properties of an object to Xml and then imported them back to a property grid instead. I would suggest that you had some structure to you Xml document (e.g. make ServerName the parent node with UserName being a child node and password being a child node of UserName. Here is the code i used for importing the properties.

try
            {
                XmlDocument config = new XmlDocument();
                config.Load("My_Xml_Doc_Path");

                // Creates instance of all node within loaded Xml docuemnt and retrieves first element by tag name
                XmlNodeList ServerName = config.GetElementsByTagName("ServerName");

                //Loops for each child node within ServerName node 
                foreach (XmlNode n in ServerName)
                {
                    //Converts XmlNode to XmlElement
                    XmlElement _ServerName = (XmlElement)n;
                    //Converts and stroes value of specified attribute in property of ObjectTypeState class
                    serverNameTextBox.txt = _ServerName.GetAttribute("ServerName").ToString();

                }

                XmlNodeList UserName = config.GetElementsByTagName("UserName");
                foreach (XmlNode n in UserName)
                {
                    XmlElement _UserName = (XmlElement)n;
                    UserNameTextBox.txt = _UserName.GetAttribute("UserName").ToString();
                }

                XmlNodeList Password = config.GetElementsByTagName("Password");
                foreach (XmlNode n in Password)
                {
                    XmlElement _Password = (XmlElement)n;
                    PasswordTextBox.txt = _Password.GetAttribute("Password").ToString();
                }
            }

I hope this helps although i'm not sure it's completely correct as i modified my original code to fit your request as mine was too long.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I don't think you have to redraw the picture just set the starting position of picture box and update the start position by adding or subtracting every time one of the directional keys are pressed.

Do a search from a C# version of space invaders, I've done that in Java before and it includes moving an image with arrow keys.

Hope this helps at all.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have you tried doing SELECT DISTINCT ? i've had this proplem in the past and i think i used SELECT DISTINCT.

ChrisHunter 152 Posting Whiz in Training Featured Poster

How is the user going enter their age ? are they just going to enter age (e.g. 18) or are the to enter their date of birth (e.g. 14/07/1989) to be checked against the current date ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Glad i could help.