<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Connecting to MS-Access in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12206752#M9901</link>
    <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I ve read a lot of topic about trable connection to MS Access. It is not getting clear.&lt;/P&gt;&lt;P&gt;I have a small function:&lt;/P&gt;&lt;P&gt;static void Access()&lt;BR /&gt;{&lt;BR /&gt;string DataBase = @"C:\Users\UserName\Documents\Database1.accdb";// and the only one simple table inside&lt;/P&gt;&lt;P&gt;// Connection string and SQL query&lt;BR /&gt;string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + DataBase;&lt;BR /&gt;string strSQL = "SELECT * FROM tbl1 order by Id";&lt;BR /&gt;// Create a connection&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;using (OleDbConnection connection = new OleDbConnection(connectionString))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;// Open the connection and execute the select command.&lt;BR /&gt;// Open connecton&lt;BR /&gt;connection.Open();&lt;BR /&gt;if (connection.State != System.Data.ConnectionState.Open)&lt;BR /&gt;{ return; }&lt;BR /&gt;// Create a command and set its connection&lt;BR /&gt;using (OleDbCommand command = new OleDbCommand(strSQL, connection))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;// Execute command&lt;BR /&gt;using (OleDbDataReader reader = command.ExecuteReader())&lt;BR /&gt;{&lt;BR /&gt;while (reader.Read())&lt;BR /&gt;{&lt;BR /&gt;string Name = (string)reader["Name"];&lt;BR /&gt;int Id = (int)reader["Id"];&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;catch (OleDbException ex)&lt;BR /&gt;{&lt;BR /&gt;string msg = ex.Message;&lt;BR /&gt;throw;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This function works in simple program&lt;/P&gt;&lt;P&gt;static void Main(string[] args)&lt;BR /&gt;{&lt;BR /&gt;Access();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But kills revit without any exception here:&lt;/P&gt;&lt;P&gt;public Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, ElementSet elements)&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;Access();&lt;BR /&gt;return Result.Succeeded;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;string str = ex.Message;&lt;BR /&gt;throw ;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Could anyone to explain why?&lt;/P&gt;&lt;P&gt;Thanks forward!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2023 12:34:10 GMT</pubDate>
    <dc:creator>OR_AND_NO</dc:creator>
    <dc:date>2023-08-30T12:34:10Z</dc:date>
    <item>
      <title>Connecting to MS-Access</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12206752#M9901</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I ve read a lot of topic about trable connection to MS Access. It is not getting clear.&lt;/P&gt;&lt;P&gt;I have a small function:&lt;/P&gt;&lt;P&gt;static void Access()&lt;BR /&gt;{&lt;BR /&gt;string DataBase = @"C:\Users\UserName\Documents\Database1.accdb";// and the only one simple table inside&lt;/P&gt;&lt;P&gt;// Connection string and SQL query&lt;BR /&gt;string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + DataBase;&lt;BR /&gt;string strSQL = "SELECT * FROM tbl1 order by Id";&lt;BR /&gt;// Create a connection&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;using (OleDbConnection connection = new OleDbConnection(connectionString))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;// Open the connection and execute the select command.&lt;BR /&gt;// Open connecton&lt;BR /&gt;connection.Open();&lt;BR /&gt;if (connection.State != System.Data.ConnectionState.Open)&lt;BR /&gt;{ return; }&lt;BR /&gt;// Create a command and set its connection&lt;BR /&gt;using (OleDbCommand command = new OleDbCommand(strSQL, connection))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;// Execute command&lt;BR /&gt;using (OleDbDataReader reader = command.ExecuteReader())&lt;BR /&gt;{&lt;BR /&gt;while (reader.Read())&lt;BR /&gt;{&lt;BR /&gt;string Name = (string)reader["Name"];&lt;BR /&gt;int Id = (int)reader["Id"];&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;catch (OleDbException ex)&lt;BR /&gt;{&lt;BR /&gt;string msg = ex.Message;&lt;BR /&gt;throw;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This function works in simple program&lt;/P&gt;&lt;P&gt;static void Main(string[] args)&lt;BR /&gt;{&lt;BR /&gt;Access();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But kills revit without any exception here:&lt;/P&gt;&lt;P&gt;public Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, ElementSet elements)&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;Access();&lt;BR /&gt;return Result.Succeeded;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;string str = ex.Message;&lt;BR /&gt;throw ;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Could anyone to explain why?&lt;/P&gt;&lt;P&gt;Thanks forward!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 12:34:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12206752#M9901</guid>
      <dc:creator>OR_AND_NO</dc:creator>
      <dc:date>2023-08-30T12:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to MS-Access</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208611#M9902</link>
      <description>&lt;P&gt;Yes, people have encountered such issues in the past. Please search this forum for existing solutions, e.g., searching for the term&amp;nbsp;&lt;SPAN&gt;&lt;U&gt;OleDbConnection&lt;/U&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&amp;amp;allow_punctuation=false&amp;amp;filter=location&amp;amp;location=forum-board:160&amp;amp;q=OleDbConnection" target="_blank"&gt;https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&amp;amp;allow_punctuation=false&amp;amp;filter=location&amp;amp;location=forum-board:160&amp;amp;q=OleDbConnection&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 05:31:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208611#M9902</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-08-31T05:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to MS-Access</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208677#M9903</link>
      <description>&lt;P&gt;Dear Jeremy thanks a lot for Your quick answer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 06:15:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208677#M9903</guid>
      <dc:creator>OR_AND_NO</dc:creator>
      <dc:date>2023-08-31T06:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to MS-Access</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208698#M9904</link>
      <description>&lt;P&gt;The right answer is here&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/cant-make-connection-to-acces-database/m-p/10879626" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/cant-make-connection-to-acces-database/m-p/10879626&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks Jeremy!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 06:33:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208698#M9904</guid>
      <dc:creator>OR_AND_NO</dc:creator>
      <dc:date>2023-08-31T06:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to MS-Access</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208714#M9905</link>
      <description>&lt;P&gt;Thank you for your appreciation and pointing to the right answer. Congratulations on solving it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 06:41:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12208714#M9905</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-08-31T06:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to MS-Access</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12212329#M9906</link>
      <description>&lt;P&gt;Since this seems to be a repeating question, I added it to the blog as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/09/add-in-threads-and-geometry-comparison.html#4" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/09/add-in-threads-and-geometry-comparison.html#4&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 15:10:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/connecting-to-ms-access/m-p/12212329#M9906</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-09-01T15:10:24Z</dc:date>
    </item>
  </channel>
</rss>

