Пример #1
0
 private void frmTeste_Load(object sender, EventArgs e)
 {
     DateTime ag;
     DateTime.TryParse(txtDate_nasc.Text, out ag);
     TimeSpan t = DateTime.Now - ag;
     txtIdade.Text = Math.Floor(t.Days / 365d) + "";
     pr = new Persist();
     cc = new ClasseConexao();
     ds = new DataSet();
     string sql = ("select * from cliente where id_cliente like '" + pr.getId()+"'");
     ds = cc.executarSQL(sql);
     if (ds == null || ds.Tables[0].Rows.Count < 1)
     {
Пример #2
0
 private void frmEdit_Prod_Load(object sender, EventArgs e)
 {
     PR = new Persist();
     cc = new ClasseConexao();
     ds = new DataSet();
     string sql = ("select * from produto where id_produto like '" + PR.getId()+"'");
     ds = cc.executarSQL(sql);
     if (ds == null || ds.Tables[0].Rows.Count < 1)
     {
         txtNome.Text = txtPreço.Text = txtQuant.Text = txtTipo.Text = "";
     }
     else
     {
         txtID_Produto.Text = ds.Tables[0].Rows[0]["id_produto"].ToString();
         txtNome.Text = ds.Tables[0].Rows[0]["nm_produto"].ToString();
         txtPreço.Text = ds.Tables[0].Rows[0]["preco"].ToString();
         txtPreço.Text = txtPreço.Text.Replace(",", ".");
         txtQuant.Text = ds.Tables[0].Rows[0]["quantidade"].ToString();
         txtTipo.Text = ds.Tables[0].Rows[0]["tipo_produto"].ToString();
     }
 }