protected double[] getValues(int ColumnCount)
        {
            double[] value = new double[ColumnCount];

            SqlConnection conGetValue = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
            SqlCommand cmdGetValue = new SqlCommand("(SELECT * FROM DailyBudget WHERE (Username=@username)) EXCEPT (SELECT Username FROM DailyBudget WHERE Username=@username)", conGetValue);
            cmdGetValue.Parameters.AddWithValue("@username", Master.getUsername);
            conGetValue.Open();
            SqlDataReader dtrGetValue = cmdGetValue.ExecuteReader();
            try
            {
                int i = 0;
                while (dtrGetValue.Read())
                {
                    value[i] = Convert.ToDouble(dtrGetValue[i]);
                    i++;
                }
            }
            finally
            {
                dtrGetValue.Close();
                conGetValue.Close();
            }

            return value;
        }

Where is my mistake? i want every columns value where Username = master.lblUsername but except the first column which is contain the username.

i want every columns value where Username = master.lblUsername but except the first column which is contain the username.

Do you mean that other columns may have the value of @username? your current syntax is only looking at the fied called "Username" and you are simply displaying all fields in the result.

in your EXCEPT, the reason for the error is that you have a mismatch of field names. in the first query you have more than field, where the second query only has one field.

First Query

Is used to select all (contain username, foods, drinks, and etc.)

Second Query

Is used to extract out the value of username

Thus, what should i do can extract username value instead of using multiple column field in the second query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.