Hi Dholariya,
you are getting this error because you are assigning SqlCommand to text box value. instead of that you can get user id using execute scalar and assign it to text box like below.
Refer this:
C#
using (SqlConnection myIDConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["connect"].ConnectionString))
{
using (SqlCommand cmdUserId = new SqlCommand("SELECT SSUserID FROM SSUserInformation WHERE UserName = @username", myIDConnection))
{
SqlParameter username = new SqlParameter("@username", SqlDbType.VarChar);
username.Value = txtUserName.Text;
cmdUserId.Parameters.Add(username);
myIDConnection.Open();
string userId = Convert.ToString(cmdUserId.ExecuteScalar());
myIDConnection.Close();
}
}