c# - Comparing a list against a dataset -


i writing vs 2012 c# winforms app has list of data need match against database. list have solely contains "propnum" values string such as, i8kj7snrxy. want able loop through list , database in order find out if there corresponding entry propnum in list.

here code puts of information list,

            con7 = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source=" + filepath);             ad7.selectcommand = new oledbcommand("select b.propkey [project]                   inner join [projlist] b on a.projkey=b.projkey a.name =                   '" + (string)combobox2.selecteditem + "'", con7);              ds7.clear();             con7.open();             ad7.selectcommand.executenonquery();             ad7.fill(ds7);             con7.close();              list<string> propnumlist = new list<string>();             foreach (datarow drrow in ds7.tables[0].rows)             {                 (int = 0; < ds7.tables[0].columns.count; i++)                 {                     propnumlist.add(drrow[i].tostring());                 }             } 

and code i'm attemping use in order find matching values,

            foreach (string propnum in propnumlist)             {                     int selection = combobox1.selectedindex;                     string enddate = "enddate";                     string qual = ds2.tables["ac_scenario"].rows[0][selection].tostring(); //if qual null break out of //if qual found store , move onto next property                     messagebox.show(qual);                     ad.selectcommand = new oledbcommand("select b.propnum,                           a.qualifier, b.keyword, b.expression [ac_economic]                           b inner join [ac_scenario] on a.propnum=b.propnum                           qualifier = '" + qual + "' , propnum = '" +                           propnum + "' , keyword = '"+enddate+"' , not                           expression '%[/@]%'", con);                      ds2.clear();                     con.open();                     ad.selectcommand.executenonquery();                     ad.fill(ds2);                     con.close();              } 

i error saying there "no value given 1 or more required parameters." assume there wrong 2nd query. if me loop through db matching against list appreciated.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -