A theoretical model for studying pattern formation in electroconvection is proposed in the form of a modified Swift-Hohenberg equation. A localized state is found in two dimension, in agreement with the experimentally observed ``worm state. The corresponding one dimensional model is also studied, and a novel stationary localized state due to nonadiabatic effect is found. The existence of the 1D localized state is shown to be responsible for the formation of the two dimensional ``worm state in our model.