StrataFrame Forum

DataSourceKey Not Defined

http://forum.strataframe.net/Topic3182.aspx

By Clayton Hoyt - 9/28/2006

Hi Folks

I have a business object assembly that will provide data to a web site. I have everything wired up but when I run it, I get the following error. Where do I set the DataSourceKey? In the past, I have always put a connection string this in an App or Web Config and gone from there. I am obviously missing something simple.

"MicroFour.StrataFrame.Data.DataLayerException: An error occurred while creating a new DataLayer for the business object. ---> MicroFour.StrataFrame.Data.DataLayerException: The DataSourceKey [] is not defined.

By Trent L. Taylor - 9/28/2006

Yes.  You need to define this in the Application_Start method of the global.asax file.  You will just manually specify the data source:

MicroFour.StrataFrame.Data.Databasics.DataSources.Add(New SqlDbDataSourceItem("","Your connection string"))

By Clayton Hoyt - 9/28/2006

Thanks much!
By Trent L. Taylor - 9/28/2006

Sure.
By Clayton Hoyt - 9/28/2006

ok...dumb question #2.Hehe..where is the SqlDbDataSourceItem located? I've searched the object viewer, your documetation and the web and come up empty. I also looked for SqlDBDataSource which sounded familiar but no go on that one either.

Thanks!

By Clayton Hoyt - 9/28/2006

Never Mind...found it under SqlDataSourceItem

Thanks!

BigGrin

By Trent L. Taylor - 9/29/2006

Yeah, that's it.  The base class is DbDataSourceItem, so sometimes my brain likes to add the Db in the class name...sorry for the confusion Hehe