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

two argument sum with executrereader

$
0
0

how to sum two argument with executereader

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);
            SqlDataReader myReader = null;
            myReader = myCommand.ExecuteReader();
            while (myReader.Read())
            {
                txtTotalWeight.AppendText(myReader["txtWeight"].ToString());
                txtTotalPrice.AppendText(myReader["txtPriceItem"].ToString());
            }
            conn.Close();

error shown

the sum function require one argument

 

 


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>