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. General Programming
  3. C#
  4. Datagrid, dataset, update, scroll

Datagrid, dataset, update, scroll

Scheduled Pinned Locked Moved C#
databaseannouncement
1 Posts 1 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.
  • B Offline
    B Offline
    Bedevian
    wrote on last edited by
    #1

    i wrote this code to delete a record. string STOCKConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ALOHA_PATH + "\\stockcontrol;Extended Properties=dBase IV"; OleDbConnection STOCKConnection = new OleDbConnection(STOCKConnString); string colID; colID= this.dataGrid1[index,0].ToString(); string STOCKUpQuery = "Delete * From STOCK.DBF Where ID=("+colID+")"; OleDbCommand STOCKUpCommand = new OleDbCommand(STOCKUpQuery,STOCKConnection); STOCKConnection.Open(); STOCKUpCommand.ExecuteNonQuery(); STOCKConnection.Close(); this record is deleted from stock.dbf, but i can still see this record in my datagrid1 i want to write a code to update my datagrid, dataset !!!! i wrote this code but it's not a good solution to refill datagrid1, coz datagtid1 is showing the records from the beginning , not from where i deleted the record but the scroll bar location is where i deleted the record !!!!!! string MyConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ALOHA_PATH + "\\stockcontrol;Extended Properties=dBase IV"; OleDbConnection MyOleb = new OleDbConnection(MyConnection); OleDbDataAdapter da= new OleDbDataAdapter("Select * from STOCK.dbf",MyOleb); DataSet dsrefresh = new DataSet(); da.Fill (dsrefresh,"Stock"); dataGrid1.DataSource = dsrefresh.DefaultViewManager; dataGrid1.ReadOnly = true; MyOleb.Close(); Thx

    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