﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Error with SqlDataSourceItem-Key</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 05:50:21 GMT</lastBuildDate><ttl>20</ttl><item><title>Error with SqlDataSourceItem-Key</title><link>http://forum.strataframe.net/FindPost27861.aspx</link><description>Hi there,&lt;P&gt;I tried the example found in the help file to manually set up my dataconnection and first tried this:&lt;/P&gt;&lt;P&gt;[CODE]&lt;/P&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;P&gt;DataLayer&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt;.DataSources.Add(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2 face="Courier New"&gt;&lt;FONT color=#0000ff size=2 face="Courier New"&gt;&lt;FONT color=#0000ff size=2 face="Courier New"&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;SqlDataSourceItem&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;""&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;"SERVER=.\SQL2008EXPRESS;INITIAL CATALOG=MyDB; Integrated Security = True"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000&gt;))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000&gt;[/CODE]&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;This works exactly like I expected it. But then I tried to insert a key&lt;/P&gt;&lt;P&gt;[CODE]&lt;/P&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;P&gt;DataLayer&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt;.DataSources.Add(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2 face="Courier New"&gt;&lt;FONT color=#0000ff size=2 face="Courier New"&gt;&lt;FONT color=#0000ff size=2 face="Courier New"&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;&lt;FONT color=#2b91af size=2 face="Courier New"&gt;SqlDataSourceItem&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;"MyKey"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000 size=2 face="Courier New"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;&lt;FONT color=#a31515 size=2 face="Courier New"&gt;"SERVER=.\SQL2008EXPRESS;INITIAL CATALOG=MyDB; Integrated Security = True"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000&gt;))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000&gt;[/CODE]&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;which causes an error when loading a form which uses a businessobject.&lt;/P&gt;&lt;P&gt;Finally I tried it like in the help described&lt;/P&gt;&lt;P&gt;[CODE]&lt;/P&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2 face="Courier New"&gt;&lt;FONT color=#008000 size=2 face="Courier New"&gt;&lt;FONT color=#008000 size=2 face="Courier New"&gt;Dim lOSQL As New SqlDataSourceItem("MyKey", "SERVER=.\SQL2008EXPRESS;INITIAL CATALOG=MyDB; Integrated Security = True")&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2 face="Courier New"&gt;&lt;FONT color=#008000 size=2 face="Courier New"&gt;&lt;FONT color=#008000 size=2 face="Courier New"&gt;DataLayer.DataSources.Add(lOSQL)&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;FONT color=#000000&gt;[/CODE]&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;which is the same but it is split up in 2 lines of code. This caused the error too.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;Can somebody help me and tell me what I am doing wrong?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;Thanks in Advance&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;Thomas&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000 face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;</description><pubDate>Mon, 09 Aug 2010 15:26:15 GMT</pubDate><dc:creator>Thomas Holste</dc:creator></item><item><title>RE: Error with SqlDataSourceItem-Key</title><link>http://forum.strataframe.net/FindPost27887.aspx</link><description>Thomas, rather than setup it up in the constructor of the BO or using the DataSourceKey of the instance on the form, use the designer of the BO itself (just double click on a Bo, the designer opens, hit F4 (to open properties) and set key there. The it is automatically set whenever it used. &lt;br&gt;
&lt;br&gt;
You'd use the form override if a particular form needed to switch data sources or you could use code override if more complicated cases.</description><pubDate>Mon, 09 Aug 2010 15:26:15 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Error with SqlDataSourceItem-Key</title><link>http://forum.strataframe.net/FindPost27872.aspx</link><description>You are welcome Thomas.&lt;br&gt;
&lt;br&gt;
With the DataSourceKey logic, StrataFrame allow us to connect to multiple databases in a single application, this way you can have an application talking by default to MS-SQL and some other business objects talking to MySQL, ORACLE, VFP, Access or whatever without the user knowing it.  This is a very, very powerful feature.</description><pubDate>Sat, 07 Aug 2010 12:26:24 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Error with SqlDataSourceItem-Key</title><link>http://forum.strataframe.net/FindPost27871.aspx</link><description>Hi Edhy,&lt;/P&gt;&lt;P&gt;thanks a lot for your help. Adding the datasourcekey did it. Setting it in the property-sheet on the form worked fine and now I'll try setting it in the constructorof the bo.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Thomas</description><pubDate>Sat, 07 Aug 2010 02:47:04 GMT</pubDate><dc:creator>Thomas Holste</dc:creator></item><item><title>RE: Error with SqlDataSourceItem-Key</title><link>http://forum.strataframe.net/FindPost27863.aspx</link><description>Hi Thomas,&lt;br&gt;
&lt;br&gt;
When using a DataSourceKey in the connection like you are doing, you also have to tell the BO to use that key, so in the BO fill the property DataSourceKey with the value of the key you are using, in this case MyKey</description><pubDate>Fri, 06 Aug 2010 10:54:04 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>