Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

two argument pass

$
0
0

how to sum two argument with executescalar

  string connstr = @"Server=.\SQLEXPRESS ;Initial Catalog=ABJDATABASE;Integrated Security=True; Max Pool Size=100";
            string query = "SELECT SUM(txtWeight,txtPriceItem) AS txtWeight,txtPriceItem FROM personalData";
            SqlConnection conn = new SqlConnection(connstr);
            conn.Open();

            SqlCommand myCommand = new SqlCommand(query, conn);
            txtTotalWeight.Text = Convert.ToString(myCommand.ExecuteScalar());
            txtTotalPrice.Text = Convert.ToString(myCommand.ExecuteScalar());
            conn.Close();

show an error:

only one argument pass so how to pass the second argument.


Viewing all articles
Browse latest Browse all 3509

Trending Articles