WebProje.admin.DB.dataGetir C# (CSharp) Méthode

dataGetir() public méthode

public dataGetir ( String tableName ) : System.Data.SqlClient.SqlDataReader
tableName String
Résultat System.Data.SqlClient.SqlDataReader
        public SqlDataReader dataGetir(String tableName)
        {
            SqlDataReader rd = null;
            try
            {
                SqlCommand cm = new SqlCommand("select *from " + tableName, conn);
                rd = cm.ExecuteReader();
            }
            catch (Exception ex)
            {

                //MessageBox.Show("Data Getir Hatası : " + ex);
            }

            return rd;
        }

Usage Example

Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DB db = new DB();

            txtBaslik.Text   = "";
            txtResimAdi.Text = "";
            txtAciklama.Text = "";
            lsd.Clear();
            yID = Request.QueryString["yerlesimID"].ToString();
            if (Request.QueryString["yerlesimID"] != null)
            {
                SqlDataReader rd = db.dataGetir("yerlesimDuzenle where yerlesimID= '" + yID + "'");
                while (rd.Read())
                {
                    txtBaslik.Text   = rd["baslik"].ToString();
                    txtResimAdi.Text = rd["resimYol"].ToString();
                    txtAciklama.Text = rd["aciklama"].ToString();

                    pYerlesimDuzenle rs = new pYerlesimDuzenle();
                    rs.YerlesimID = rd["yerlesimID"].ToString();
                    rs.Baslik     = rd["baslik"].ToString();
                    rs.ResimYol   = rd["resimYol"].ToString();
                    rs.Aciklama   = rd["aciklama"].ToString();
                    rs.Tarih      = rd["tarih"].ToString();
                    lsd.Add(rs);
                }
            }
            else
            {
                // yönlendirme yap
                Response.Redirect("yerlesimDuzenle.aspx");
            }
            db.kapat();
        }
All Usage Examples Of WebProje.admin.DB::dataGetir