not able to display Max salary from table (test)

Kalpesh Patil

I have a table, from which I am unable to select max salary.
Here is my code...

con.Open();
SqlCommand cmd = new SqlCommand("SELECT MAX(salary) AS MAximumSalary FROM test", con);
cmd.ExecuteNonQuery();    
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
count =Convert.ToInt32(dt.Rows.Count.ToString());
con.Close();
MessageBox.Show("Maximum salary is" +count);

Here is my database:-

name     salary
a       10000
b       31000
c       17000
Muhammad Raja
using (SqlCommand cmd = new SqlCommand("SELECT MAX(salary) FROM test"), con)
{
    int maxSalary = (int)cmd.ExecuteScalar();
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find max and second max salary for a employee table MySQL

From Dev

Display: table and max attributes

From Dev

Display: table and max attributes

From Dev

not able to display image from a folder

From Dev

Not able to display correct data in table -AngularJS

From Dev

not able to display record count in data table

From Dev

Display 2 columns from one table having max count in column 3 and display computed sum of values from another table

From Dev

Nth max salary in Oracle

From Dev

Nth max salary in Oracle

From Dev

Not able to display the current data sent from server

From Dev

Not able to display data from post in ionic

From Dev

Not able to display value after selecting from dropdown

From Dev

What query should I write to calculate the cumulative salary of employees from the salary table

From Dev

Max-Width on DIV with Display: Table

From Dev

Find out the nth-highest salary from table

From Dev

not able to select the data from a table in hive

From Dev

Joining with max date from table

From Dev

Get max value from table

From Dev

Display max value from two Div Tags

From Dev

PHP - Not able display images which src comes from database

From Dev

not able to display fetch value from database in devextreme dxDataGrid

From Dev

Not being able to display Image from MySQL Database in PHP

From Dev

Display data from table in php

From Dev

Display content on click from table

From Dev

Display a table on a webpage from database

From Dev

display result from 2 table

From Dev

Fetch data from table and display it in bootstrap table

From Dev

Tricky Firefox responsive layout issue with display table and max-width

From Dev

Max width in percentage inside table-cell display container

Related Related

HotTag

Archive