"What Is Wrong Wd Ds"
Would you like a list?
Start with your incorrect use of case: It Isn't A Upper Case For Every Word. A sentence starts with Upper Case - after that it's Lower Case except for names.
Then, it's your dislike of vowels: "Wd Ds" - "with this".
"I M" should have an apostrophe: "I'm"
Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
Why convert a value to a string, and then immediately convert that to an integer?
int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
Instead, just cast the value:
int temp = (int) com.ExecuteScalar();
Never store passwords in clear text - it is a major security risk. There is some information on how to do it here:
Password Storage: How to do it.[
^]
String.Replace replaces all instances, not just the ones at the ends. Use String.Trim for that.
Why close a connection, if you are about to immediately open it again?
Connections and Commands are scares resources - you are responsible for closing and disposing of them. The easiest way to do this is to use a
using
block.
And finally: look at your data. Use the debugger to follow your code through and look at exactly what is happening. We can't - we don't have access to your SQL server instance or your DB...