Skip to content
Loading
  • Abhilash J A
    +1
    Do you mean this ?
    1. MySqlConnection dbConnection = new MySqlConnection(ConfigurationManager.ConnectionStrings["qscanConnectionStrings"].ConnectionString);  
    2.   
    3. public void deleteLog(int logId)  
    4.        {  
    5.            string sql = "UPDATE Tble_UserSetUp SET IsActive = 0 WHERE Id='" + logId + "'";  
    6.            MySqlCommand insertSQL = new MySqlCommand(sql, (MySqlConnection)dbConnection);  
    7.            try  
    8.            {  
    9.                dbConnection.Open();  
    10.                insertSQL.ExecuteNonQuery();  
    11.                dbConnection.Close();  
    12.            }  
    13.            catch (Exception ex)  
    14.            {  
    15.                throw new Exception(ex.Message);  
    16.            }  
    17.   
    18.        } 
     
    +1
  • Sundaram Subramanian
    +1
    whereClause = "WHERE 1 = 1"
    if(keywords is not null)
    {
    whereClause += "AND description LIKE '%keywords%'"
    }
    if(price is not null)
    {
    whereClause += "AND price = '%price%'"
    }
    +1
  • +1
    Thanks Rajkiran Swain your answer ....... is really worked a lot for me in creating pasting dynamic query in mySql.
    +1