Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:01:53+00:00 2026-06-02T04:01:53+00:00

I have an Access table that I recently added an attachment field to. The

  • 0

I have an Access table that I recently added an attachment field to. The table is a listing of computers and information about each computer. The users of it, software installed, and so on. The Attachment field will contain a simple text configuration file received from each computer.

I worked with some code found here: Programmatically managing Microsoft Access Attachment-typed field with .NET

My problem is I can’t seem to update the correct field. Meaning the configuration file for computer name Bob is getting placed in the correct field but wrong computer if that makes sense. Below is an SQL statement example.

Select * From MyTable WHERE ComputerName Like 'Bob'

Whole code segment below as requested.

public void InsertFile(String Path, String CmpName)
{   
    DBEngine dbe = new DBEngine();
    Database db = dbe.OpenDatabase("MyAccessDB.accdb", false, false, "");
    Recordset rs = db.OpenRecordset(
        "SELECT * FROM MyTable WHERE ComputerName LIKE '" + CmpName + "\'",
        RecordsetTypeEnum.dbOpenDynaset, 0, LockTypeEnum.dbOptimistic);
    rs.MoveFirst();
    rs.Edit();
    Recordset2 rs2 = (Recordset2)rs.Fields["My_File"].Value;
    rs2.AddNew();
    Field2 f2 = (Field2)rs2.Fields["FileData"];
    f2.LoadFromFile(Path);

    rs2._30_Update();
    rs2.Close();
    rs._30_Update();
    rs.Close();          
}

I was hoping that when using OpenRecodeset() the above statement would give me just that row and then the only attachment field for that row. However this is not the case. I have searched to find how to iterate the record set to find the right row with no luck. I am new here so I hope I covered everything I needed to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:01:55+00:00Added an answer on June 2, 2026 at 4:01 am

    I’m not sure if I’m understanding your issue but if all you want is the attachment field your SQL query should be:

    "SELECT attachment FROM MyTable WHERE UCASE(ComputerName) = 'BOB'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a legacy MS Access 2007 table that contains 52 fields (1 field
I have a ms access database that has one table for each photo album
I have an Access table that has a hyperlink field, with the records being
I have a MS access database. In that, one table consists of questions and
In one of the ms-access table I work with we have a text field
I have a Access Data Project that connects to an SQL server database. Recently
Let's say I have an Access database table that has 2 columns: one is
I have an access table that I am trying to add fields programmatically using
I have got a TTable component that uses the BDE to access a DBase
I have Access table with fields, in which there is some data and path

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.