public void ExecuteSearch(CAMVIEW_Sales qryObj) { DataTable dt = new DataTable(); SqlConnection cn = null; SqlDataAdapter da = null; cn = new SqlConnection(conStr); try { cn.Open(); } catch (Exception e) { Console.WriteLine(e.ToString()); } String sqlStr = ""; sqlStr = sqlStr + "select * from CAMVIEW_Sales "; sqlStr = sqlStr + clsSqlHelper.buildWhereStr(qryObj); String csqlStr = "Select Count(*) FROM (" + sqlStr + ") a"; SqlCommand ccmd = new SqlCommand(csqlStr, cn); try { rec_count = (int)ccmd.ExecuteScalar(); } catch { rec_count = 0; } SqlCommand cmd = new SqlCommand(sqlStr, cn); da = new SqlDataAdapter(cmd); dt = new DataTable(); DataSet dSet = new DataSet(); da.Fill(dt); PrepResults(dt); cn.Close(); }
public void AddSearchResult(CAMVIEW_Sales psr) { aps.Add(psr); //CAMVIEW_Sales_list = (CAMVIEW_Sales[])aps.ToArray(typeof(CAMVIEW_Sales)); }
private void PrepResultsfull(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { CAMVIEW_Sales sr = new CAMVIEW_Sales(); try { sr.PRPROP = (System.String)dt.Rows[i]["PRPROP"]; } catch { } try { sr.PIN = (System.String)dt.Rows[i]["PIN"]; } catch { } try { sr.Sale_Date = (System.String)dt.Rows[i]["Sale_Date"]; } catch { } try { sr.Sale_Price = (System.Decimal)dt.Rows[i]["Sale_Price"]; } catch { } try { sr.Sale_Qual = (System.String)dt.Rows[i]["Sale_Qual"]; } catch { } try { sr.Book = (System.Int32)dt.Rows[i]["Book"]; } catch { } try { sr.Page = (System.Int32)dt.Rows[i]["Page"]; } catch { } try { sr.Instrument = (System.String)dt.Rows[i]["Instrument"]; } catch { } try { sr.Vacant_Impr = (System.String)dt.Rows[i]["Vacant_Impr"]; } catch { } try { sr.acres = (System.Decimal)dt.Rows[i]["acres"]; } catch { } try { sr.Year_Built = (System.Int32)dt.Rows[i]["Year_Built"]; } catch { } try { sr.Address_Street = (System.String)dt.Rows[i]["Address_Street"]; } catch { } try { sr.Address_House = (System.String)dt.Rows[i]["Address_House"]; } catch { } try { sr.Address_Type = (System.String)dt.Rows[i]["Address_Type"]; } catch { } try { sr.Address_Dir = (System.String)dt.Rows[i]["Address_Dir"]; } catch { } try { sr.District = (System.Int32)dt.Rows[i]["District"]; } catch { } try { sr.Heated_Sq_Ft = (System.Int32)dt.Rows[i]["Heated_Sq_Ft"]; } catch { } try { sr.Subdivision_Code = (System.String)dt.Rows[i]["Subdivision_Code"]; } catch { } try { sr.Subdivision = (System.String)dt.Rows[i]["Subdivision"]; } catch { } try { sr.LandUse = (System.String)dt.Rows[i]["LandUse"]; } catch { } aps.Add(sr); } //CAMVIEW_Sales_list = (CAMVIEW_Sales[])aps.ToArray(typeof(CAMVIEW_Sales)); }