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

how to pass two argument

$
0
0

i want to sum of one column output show in  txtTotalWeight and other output show in txtTotalPrice not both of the sum

string connstr = @"Server=.\SQLEXPRESS ;Initial Catalog=ABJDATABASE;Integrated Security=True; Max Pool Size=100";
            string query = "SELECT SUM(txtWeight)+ SUM(txtPriceItem) AS txtWeight 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();


Viewing all articles
Browse latest Browse all 3509

Trending Articles



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