c# Database Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idandush
    New Member
    • Jul 2007
    • 7

    c# Database Problem

    I have a lil problem , maybe someone here can help me ?
    i have an access database called "UserDetail s".
    I can Write to it , i can read from it , all is good .
    now i wana Update some fields in it , maybe even a full row , i dont really mind .
    so my code goes like this :
    Code:
    string stAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=TestDriveDatabase.mdb";
    OleDbConnection DBconn = new OleDbConnection(stAccessConn);
    OleDbCommand MyAccessCommand = new OleDbCommand(stAccessSelect, DBconn);
    OleDbDataAdapter MyDataAdapter = new OleDbDataAdapter(MyAccessCommand);
    
    DBconn.Open();
    DataSet myds = new DataSet();
    MyDataAdapter.Fill(myds, "UserDetails");
    myds.Tables[0].Rows[1]["FirstName"] = "******";
    OleDbCommandBuilder mybuilder = new OleDbCommandBuilder(MyDataAdapter);
    DBconn.Close();
    it looks like it all works , yet the file wont change !! :(
    anyone ??
    Last edited by NeoPa; Jul 11 '07, 09:06 PM. Reason: Obscenity
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Moving this to the Access forum.

    Comment

    • JKing
      Recognized Expert Top Contributor
      • Jun 2007
      • 1206

      #3
      Hi it's been a while since I've used C# but I think see a probelm in this line:
      Code:
      myds.Tables[0].Rows[1]["FirstName"] = "censored";
      Do you not need a .(dot) between Rows[1] and ["FirstName"]?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32662

        #4
        Please do NOT use obscene language in these forums.
        I am locking this thread, so if JKing's answer is not to your liking I suggest you repost the question without the obscenity.

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          This question is being moved to the .NET forum. It doesn't belong in the access forum.

          Comment

          Working...