protected void Page_Load(object sender, EventArgs e) { //tabelaZlecenia.Rows.Clear(); DataView view = (DataView)SqlDataZleceniodawcy.Select(DataSourceSelectArguments.Empty); DataTable table = view.ToTable(); DataSet ds = new DataSet(); ds.Tables.Add(table); foreach (DataRow row in ds.Tables[0].Rows) { HtmlTableRow htmlrow = new HtmlTableRow(); HtmlTableCell htmlcell = new HtmlTableCell(); HtmlTableCell htmlcell2 = new HtmlTableCell(); HtmlTableCell htmlcell3 = new HtmlTableCell(); HtmlTableCell htmlcell4 = new HtmlTableCell(); HtmlTableCell htmlcell5 = new HtmlTableCell(); htmlcell.InnerText = row["Imie"].ToString() + " " + row["Nazwisko"].ToString(); htmlrow.Cells.Add(htmlcell); htmlcell2.InnerText = row["NazwaFirmy"].ToString(); htmlrow.Cells.Add(htmlcell2); htmlcell3.InnerText = row["email"].ToString(); htmlrow.Cells.Add(htmlcell3); htmlcell4.InnerText = row["Telefon"].ToString(); htmlrow.Cells.Add(htmlcell4); htmlcell5.InnerText = row["NIP"].ToString(); htmlrow.Cells.Add(htmlcell5); tabelaZleceniodawcy.Rows.Add(htmlrow); tabelaZleceniodawcy.DataBind(); } }
public string getZleceniodawcyById(int id) { string nazwaFirmy, imie, nazwisko; nazwaFirmy = imie = nazwisko = null; DataView view = (DataView)SqlDataZleceniodawcy.Select(DataSourceSelectArguments.Empty); DataTable table = view.ToTable(); DataSet ds = new DataSet(); ds.Tables.Add(table); foreach (DataRow row in ds.Tables[0].Rows) { if (int.Parse(row["Id"].ToString()) == id) { nazwaFirmy = row["NazwaFirmy"].ToString(); imie = row["Imie"].ToString(); nazwisko = row["Nazwisko"].ToString(); } } return(nazwaFirmy + " " + imie + " " + nazwisko); }