Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Using > than operator

$
0
0

I want to compare the MAX Value of a SQL String to a value in a field on my webform, this is the code I use

string MAXQuery = "SELECT MAX(ID) FROM employees";
					SqlCommand myCommand = new SqlCommand(MAXQuery, connection);
					int maxId = Convert.ToInt32(myCommand.ExecuteScalar());
					string strMaxID = Convert.ToString(maxId);
					if (strMaxID >= txtID.Text)
					{

But it highlights my if statement and tells me operator > can not be applied to operands of string and string


Viewing all articles
Browse latest Browse all 23244

Trending Articles



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