Assuming the actual SQL statement you are trying to run is correct I would change your code as follows:
SCon.Con.Open();
string str = "Select count(*) from Studdet where studid = @studid";
SqlCommand cmd = new SqlCommand(str, SCon.Con);
cmd.Parameters.AddWithValue("@studid", Convert.ToInt(txt_Studid.Text.Trim()));
This is:
a) uses parameters to reduce changes of SQL injection,
b) allows the SQL query to actually work with the given parameter.
c) Converts the text entered to an integer value
I would also add additional checking on the information entered into the txt_Studid text box using the validating event to ensure only positive integer values have been entered but that is addition.
I would also do the following as suggested by nitin bhoyate in his solution.
int count =0;
object obj = cmd.ExecuteScalar();
if(obj!=null)
{
count =convert.toint(obj.tostring());
}