After making some more research on the subject I actually found freely available articles of experts in the field (people working with those norms)... Inside of them you can find not only the explanation of the concepts but also citations of the norm... for example:
http://www.ewsolutions.com/resource-center/rwds_folder/rwds-archives/issue.2009-10-12.0790666855/document.2009-10-12.3367922336/view?searchterm=ISO%208000%20data%20quality
as you can find quite a lot of such articles in the Internet and some of the authors actually come from USA I assume what was discussed in this thread is not intellectual property theft also in USA...
so the thread is solved... :-)
Szpilona 18 Light Poster
1. If you want to do any operations on array of values it does must have some values so fill array with values:
int[] value = new int[5] { 5, 1, 2, 4, 3 };
you can also give the user the possibility to specify the values:
int[] value = new int[5];
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Specify number " + (i + 1).ToString() + ": ");
value[i] = Convert.ToInt32(Console.ReadLine());
}
but remember that conversion from string to int is not always possible so you should put it in the try catch block (if you're already familiar with errors handling)...
2. using
arrayName[index]
syntax you get the value form array!
You're code after corrections... I did not added any sophisticated code trying to make it easier for you...
int[] value = new int[5] { 5, 1, 2, 4, 3 };
/*
int[] value = new int[5];
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Specify number " + (i + 1).ToString() + ": ");
value[i] = Convert.ToInt32(Console.ReadLine());
}
*/
int sum = 0, multip = 1;
string tpl= "", crp= "";
for (int i = 0; i < 5; i++)
{
sum += value[i];
multip *= value[i];
if (i != 4)
{
tpl += value[i].ToString() + " + ";
crp += value[i].ToString() + " * ";
}
else
{
tpl += value[i].ToString();
crp += value[i].ToString();
}
}
Console.Clear();
Console.Write(tpl + " = " + sum.ToString() + "\n"); …
ddanbe commented: Very helpfull. +6
Szpilona 18 Light Poster
set enable property to false....
Szpilona 18 Light Poster
No line is highlighted... so I am not sure if you refer to the code proposed by me or to your modified version... But:
1. there's many ways to connect to the database but you have to choose one in any case and stick to it... so you open the connection using your own class:
DB db = new DB();
db.openConnection();
db.closeConnection();
or you do that in the way I proposed
using (SqlConnection connection = new SqlConnection(connectionString)) {}
or choose another possibility to do that but simply decide to something...
2. If you ask a question add all the information that can be useful to find the solution - in that case, as you mentioned that an error occurred, you could copy and paste the message...
if you referred to your version of the code certainly you are missing the closing bracket ")" in the end of the line... you typed:
using(SqlConnection connection = new SqlConnection(connectionsrting)
it should be:
#
using (SqlConnection connection = new SqlConnection(connectionString))
3. You do NOT have to close the connection to the database in the above example (at least if you will decide to stick to my version). As the connection is open in the using statement outside of the defined scope it will be disposed... (refer to MSDN documentation of using statement)...
4. I guess there's more errors in your code snippet but it is a little bit hard to process - correct it using above …
Szpilona 18 Light Poster
You do not know the proper definition of that operator.
The syntax:
boolean_expression ? expression1 : expression2
Expression is any operation which returns a value. Void is not a value. Void specifies that no value is returned. If your get this message, at least one of your methods, must return void value. What is more you must in that context assign the value returned by the "?:" operator.
Proper usage of that operator:
private int m1(int a)
{
return a;
}
private int m2(int a)
{
return a + a;
}
private void button3_Click(object sender, EventArgs e)
{
int j = 0;
for (int i = 0; i < 10; i++)
{
j = (i > 5) ? m1(i) : m2(i);
}
}
If you don't want to use a value returned by the operator - you just want to decide which method to execute, use if - else or switch - case expressions.
ddanbe commented: Well explained. +6
Szpilona 18 Light Poster
There's many ways to handle such a situation. Probably when a user log in you connect to the database to check his/her data. In that moment you can just add to the combobox his/her first name, last name and remember in variable his/her UserID (so the field which uniquely identify users). Then you can use a method like below:
private void FillComboBox(string connectionString, string loggedUserID)
{
string query = "select UserID, FirstName, LastName from DaniWeb.dbo.Users;";
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(query, connection);
connection.Open();
SqlDataReader sqlReader = command.ExecuteReader();
try
{
while (sqlReader.Read())
{
if (sqlReader[0].ToString() != loggedUserID)
comboBox2.Items.Add(sqlReader[1] + " " + sqlReader[2]);
}
}
catch (Exception ex)
{
MessageBox.Show("An error occurred: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
sqlReader.Close();
}
}
}
Szpilona 18 Light Poster
It may be a little bit vague but hope it will help you...
Firstly you created an instance of the Elephant class:
Elephant lloyd = new Elephant() { Name = "Lloyd", EarSize = 40 };
so the variable lloyd is now containing the reference to that object.
Then using:
lucinda.SpeakTo(lloyd, "Hello");
you passed the reference to lloyd.
SpeakTo function got the reference to lloyd. As the function is declared as follows:
public void SpeakTo(Elephant talkTo, string message)
locally talkTo refer to lloyd.
So, using:
talkTo.TellMe(message, this);
you refer to lloyd function TellMe.
Szpilona 18 Light Poster
Read() method reads the next (only 1 character) from the standard input so you get ASCII codes of the number...
Try that instead:
nr1 = Convert.ToInt32(Console.ReadLine());
But put it into "try catch"...
btw make the fields private... and move temp declaration to InternGhange() function...
Sample code after little corrections:
class Numbers
{
private int nr1 = 0;
private int nr2 = 0;
public void GetNr1()
{
Console.WriteLine("Read nr1:");
try
{
nr1 = Convert.ToInt32(Console.ReadLine());
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
Console.ReadLine();
}
public void GetNr2()
{
Console.WriteLine("Read nr2:");
try
{
nr2 = Convert.ToInt32(Console.ReadLine());
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
Console.ReadLine();
}
public void InternGhange()
{
int temp = nr1;
nr1 = nr2;
nr2 = temp;
Console.WriteLine("The numbers are now:");
Console.ReadLine();
Console.WriteLine("nr1={0}",nr1);
Console.ReadLine();
Console.WriteLine("nr2={0}",nr2);
}
}
ddanbe commented: Nice. +6