<?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 Re: Data Standard 2016 - Run SQL query error in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6770563#M7956</link>
    <description>&lt;P&gt;First paragraph should read: sqlps is not part auf default Powershell installation, sorry about that. (I can not edit my post anymore?)&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2016 08:08:07 GMT</pubDate>
    <dc:creator>Tim_Kreutzer</dc:creator>
    <dc:date>2016-12-27T08:08:07Z</dc:date>
    <item>
      <title>Data Standard 2016 - Run SQL query error</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6733152#M7954</link>
      <description>&lt;P&gt;I want to run a SQL query to check if the value "item number" in my Vault Data Stanadard dialog and a value in a SQL table is the same.&amp;nbsp;If that is true set a check box = checked. This function runs OnTabContextChanged.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this function i want to check if a item is transferd to the ERP System and the user can see this in the datasheet of the item. It is only for troubleshooting if the interface between Vault and the ERP system doesn't work proberly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the cmdlet Invoke-Sqlcmd and everything work fine. But if you start Vault and go the datasheet you get an error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SQL.JPG" style="width: 384px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/299728i4F3162ED75B47C96/image-dimensions/384x136?v=v2" width="384" height="136" role="button" title="SQL.JPG" alt="SQL.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For every non german reader:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Than i tried something from a blogpost:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://stackoverflow.com/questions/6425707/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime" target="_self"&gt;http://stackoverflow.com/questions/6425707/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Edit the&amp;nbsp;Connectivity.VaultPro.exe.config and add the lines from the blog post.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;startup&amp;gt;
&amp;lt;useLegacyV2RuntimeActivationPolicy="true"&amp;gt;
&amp;lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/&amp;gt;
&amp;lt;/startup&amp;gt;&amp;lt;/configuration&amp;gt;&lt;/PRE&gt;&lt;P&gt;And everything is working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But am I allowed to add these lines in the config? Or is there a reason don't do this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 11:27:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6733152#M7954</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-07T11:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Data Standard 2016 - Run SQL query error</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6768737#M7955</link>
      <description>&lt;P&gt;Sorry for going slightly off topic, but are you aware of the fact that the sqlps module is not part of the standard dot net framework? If you deploy to machines which do not have some kind of sql installation (server, management studio, etc...), your code will not work without installing sqlps manually.&lt;BR /&gt;&lt;BR /&gt;You could use an instance of system.data.sqlclient.sqlconnection, which is in default .NET&lt;BR /&gt;&lt;BR /&gt;It will work without tweaking any config files, too. Just google powershell + sqlconnection, it is pretty straightforward.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Since the code in the Data Standard ps1-Files is readable and changeable by the user, you may want to double check that he cannot do something nasty by altering the query. I'd perhaps go for a stored procedure which returns only the value of interest and give the users permission to use this and nothing else.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2016 13:38:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6768737#M7955</guid>
      <dc:creator>Tim_Kreutzer</dc:creator>
      <dc:date>2016-12-24T13:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Data Standard 2016 - Run SQL query error</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6770563#M7956</link>
      <description>&lt;P&gt;First paragraph should read: sqlps is not part auf default Powershell installation, sorry about that. (I can not edit my post anymore?)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 08:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6770563#M7956</guid>
      <dc:creator>Tim_Kreutzer</dc:creator>
      <dc:date>2016-12-27T08:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Data Standard 2016 - Run SQL query error</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6795190#M7957</link>
      <description>&lt;P&gt;Hi Tim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry for my late answer. I will check your solution and will post my result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 13:39:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6795190#M7957</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-10T13:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Data Standard 2016 - Run SQL query error</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6795559#M7958</link>
      <description>&lt;P&gt;Now i found a better solution with your hint&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.administrator.de/frage/powershell-sql-abfrage-266193.html" target="_blank"&gt;https://www.administrator.de/frage/powershell-sql-abfrage-266193.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this function from the link above&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;function Get-SQLTableContents($query,$server,$database,$username,$password){
    $conn = new-object System.Data.SqlClient.SqlConnection
    $conn.ConnectionString = "Server=$server;Database=$database;Integrated Security=False;UID=$username;PWD=$password"
        try{
            $conn.Open()
            $cmd = $conn.CreateCommand()
            $cmd.CommandText = $query
            $cmd.Connection = $conn

            $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
            $SqlAdapter.SelectCommand = $cmd
            $dt = New-Object System.Data.DataTable
            $SqlAdapter.Fill($dt) | out-null
            $conn.close()
            return $dt
        }
        catch{
            echo "Fehler: $($_.Exception.Message)"
            $conn.close()
            return $false
        }
}

$data = Get-SQLTableContents "Select * from TestTable" "192.168.1.95" "TestDB" "sqluser" "Passw0rd"
$data&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:19:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/data-standard-2016-run-sql-query-error/m-p/6795559#M7958</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-10T15:19:16Z</dc:date>
    </item>
  </channel>
</rss>

