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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to write?

how to write?

Scheduled Pinned Locked Moved C#
databasetutorialquestion
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.
  • S Offline
    S Offline
    s4_sabahatf
    wrote on last edited by
    #1

    OleDbConnection m_Connection = new OleDbConnection(); m_Connection.ConnectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:user.mdb"; m_Connection.Open(); //m_Connection.Close(); Can any one tell me that how could i write edit command using this db

    R 1 Reply Last reply
    0
    • S s4_sabahatf

      OleDbConnection m_Connection = new OleDbConnection(); m_Connection.ConnectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:user.mdb"; m_Connection.Open(); //m_Connection.Close(); Can any one tell me that how could i write edit command using this db

      R Offline
      R Offline
      Roger CS
      wrote on last edited by
      #2

      Essentially you have four things you can do: SELECT, INSERT, UPDATE and DELETE. When you edit a record you first SELECT the record, make changes then use UPDATE to save the changes to the database. Go to msdn.com and click the Library link, search for OleDbDataAdapter. Here's an example from... public DataSet CreateCmdsAndUpdate(DataSet myDataSet,string myConnection,string mySelectQuery,string myTableName) { OleDbConnection myConn = new OleDbConnection(myConnection); OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(); myDataAdapter.SelectCommand = new OleDbCommand(mySelectQuery, myConn); OleDbCommandBuilder custCB = new OleDbCommandBuilder(myDataAdapter); myConn.Open(); DataSet custDS = new DataSet(); myDataAdapter.Fill(custDS); //code to modify data in dataset here myDataAdapter.Update(custDS, myTableName); myConn.Close(); return custDS; }

      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