Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to fetch particular column form dataset?

How to fetch particular column form dataset?

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netregextutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Care Career
    wrote on last edited by
    #1

    Hi Plz help me,i want to match textbox value to table'a value like in below code E_CODE.when i write ds.Tables["EMPLOYEE"]["E_CODE"] it gives error like Can not apply indexing with [] to an expression of type System.Data.DataTable. I m using asp.net with C# conn.Open(); strSelect = "Select E_CODE from EMPLOYEE"; da.SelectCommand = new SqlCommand(strSelect, conn); da.Fill(ds, "EMPLOYEE"); for (int i = 0; i < ds.Tables["EMPLOYEE"].Rows.Count; i++) { if (txtECODE.Text == ds.Tables["EMPLOYEE"]["E_CODE"]) { ds.Clear(); string strSelectall = "Select * from Employee"; da.SelectCommand = new SqlCommand(strSelectall, conn); da.Fill(ds, "Employee"); GrdEmpInfo.DataSource = ds.Tables["EMPLOYEE"]; GrdEmpInfo.DataBind(); } Thanks Care Career

    _ 1 Reply Last reply
    0
    • C Care Career

      Hi Plz help me,i want to match textbox value to table'a value like in below code E_CODE.when i write ds.Tables["EMPLOYEE"]["E_CODE"] it gives error like Can not apply indexing with [] to an expression of type System.Data.DataTable. I m using asp.net with C# conn.Open(); strSelect = "Select E_CODE from EMPLOYEE"; da.SelectCommand = new SqlCommand(strSelect, conn); da.Fill(ds, "EMPLOYEE"); for (int i = 0; i < ds.Tables["EMPLOYEE"].Rows.Count; i++) { if (txtECODE.Text == ds.Tables["EMPLOYEE"]["E_CODE"]) { ds.Clear(); string strSelectall = "Select * from Employee"; da.SelectCommand = new SqlCommand(strSelectall, conn); da.Fill(ds, "Employee"); GrdEmpInfo.DataSource = ds.Tables["EMPLOYEE"]; GrdEmpInfo.DataBind(); } Thanks Care Career

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      Care Career wrote:

      if (txtECODE.Text == ds.Tables["EMPLOYEE"]["E_CODE"])

      It should be ds.Tables["EMPLOYEE"].Rows[i]["E_CODE"].ToString();

      Best Regards, Apurva Kaushal

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups