help with IF statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preeti13
    New Member
    • Aug 2007
    • 67

    help with IF statement

    Hi friends i need a help with if statement iam try to do if record is exist then display the msg but getting the error .The type or namespace name 'Exist' could not be found (are you missing a using directive or an assembly reference?)

    my code is like this

    Code:
    	private void cmdAdd_Click(object sender, System.EventArgs e)
    		{
    		
    			SqlConnection oConn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["oConn"]);
    			SqlDataAdapter da=new SqlDataAdapter("usp_insertproject", oConn);
    			da.SelectCommand.CommandType=CommandType.StoredProcedure; 
    			
    			da.SelectCommand.Parameters.Add(new SqlParameter("@ProjectName",txtprojectname.Text));
    			da.SelectCommand.Parameters.Add(new SqlParameter("@ProjectDesc",txtDescription.Text));
    
    			SqlParameter projectid = new SqlParameter("@projectID",SqlDbType.Int); 
    			projectid.Direction = ParameterDirection.Output; 
    			da.SelectCommand.Parameters.Add(projectid);
    
    
    			oConn.Open();
    			da.SelectCommand.ExecuteNonQuery();
    			oConn.Close();
    
    			if(Exist)
    			{
    			Response.Write("Record is already exist");
    			}
    				}
    	}
    }
    and the probelm is here

    Code:
    if(Exist)
    			{
    			Response.Write("Record is already exist");
    			}
    
    please help me
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    You don't define Exist anywhere.
    You need an Exist boolean value declared somewhere. And then you will probably want to set it.

    Comment

    Working...