c# - How do I determine if one value is almost like another value (e.g. street abbreviations)? -
i have question elements in datarow. have array of datarow elments so:
datarow[] rows = dt.rows.cast<datarow>().toarray();
i using loop loop through elements so:
( int = 0; < rows.count(); i++) { if (rows[i].itemarray.elementat(0).tostring().equals("order")) { ...do stuff... } }
in "do stuff" section need check address see if same previous order person. address can change, same, or similiar.
by similiar mean this:
11555 old oregon tr 11555 old oregon trail 11555 old oregon trl.
all 3 same address, variations. now, question. there way run operation on element of datarow array? want check if address other previous order. i've been looking around little , haven't found proof can wanted ask question see if knew of solution, or workaround per say.
i may dinged because doesn't technically answer question directly, consider sqlfiddle. leverages soundex
perform operation. query might this:
select * addresses soundex(address) = soundex('11555 old oregon tr')
so you're looping through rows this:
var sql = "select * addresses soundex(address) = soundex(@address)"; var cmd = new sqlcommand(sql, conn); using (sqldatareader reader = cmd.executereader()) { // perform logic in here because you're looping through realted // rows , row queried against }
where conn
sqlconnection
object.
Comments
Post a Comment