Pertti Karjalainen
|
|
Group: Forum Members
Posts: 54,
Visits: 4K
|
I just refreshed my Strataframe version last night due to various weirdnesses. Now those weirdnesses are gone, but new weirdnesses are showing up. Of course, it could be just my own weirness, but nevertheless I need some help... 1. When I go through the Business Object Mapper and set it up as OLDEDB to access my VFP data, everything looks ok until I go to specify the data source. The system "enumerates" data sources and comes up with this screen: CPW.DBC is a VFP database, there is no CPW.DBC anywhere in my SQL Server, yet Object Mapper SEEMS to think that this VFP DBC lives in my SQL server. From here, I can move forward and see the VFP tables and fields just fine. However, when I run the program and it tries to fill data table, I get this: And here's the error "dump": System.ArgumentException was unhandled by user code Message="Format of the initialization string does not conform to specification starting at index 0." Source="System.Data" StackTrace: at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) at System.Data.SqlClient.SqlConnection..ctor(String connectionString) at MicroFour.StrataFrame.Data.SqlDataSourceItem.CreateBlankDbConnection() at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack) at MicroFour.StrataFrame.Data.SqlDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack) at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(String Statement, OnChangeEventHandler CallBack) at MicroFour.StrataFrame.Data.DataLayer.GetDataTable(String Statement, Boolean RegisterNotification) at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(String SelectStatement) at CMBPermitsBOLibrary.CMBPermitsBO.FillTop100() in C:\StrataframeProjects\CMBPermitsBOLibrary\CMBPermitsBO.cs:line 55 at Editpage.Page_Load(Object sender, EventArgs e) in c:\StrataframeProjects\CMBpermits\Editpage.aspx.cs:line 16 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
|
|
|
StrataFrame Team
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
The problem is that your application was configured to use an SQL connection. Either the SQL connection string was the only one added to your application, or you have both an SQL connection and a VFP connection and your business object is pointing at the wrong one. Within the SetDataSources() method of the AppMain.vb file, check to make sure that the AddRequiredDataSource() method call is not adding a SQL connection. If you're setting the connection manually, then make sure you add a VfpDataSourceItem to the collection, not a SqlDataSourceItem. If you have both a SQL connection and a VFP connection, you need to set the DataSourceKey property on your business object to point to the VFP connection, not the SQL connection.
|
|
|
Pertti Karjalainen
|
|
Group: Forum Members
Posts: 54,
Visits: 4K
|
This is a C# Web application. I looked at the global.asax -file and commented out SQL and uncommented VFP. Still experiencing the same *&#*$& problem...
|
|
|
StrataFrame Team
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
When you uncommented the VFP data source item, did you change the connection string? By default it just says "myconnstring"... it needs to be something like this: Provider=VFPOLEDB;Data Source=C:\MyVfpPath\CPW.DBC;
|
|
|
Pertti Karjalainen
|
|
Group: Forum Members
Posts: 54,
Visits: 4K
|
Hmmm... I'm using the SF Object Mapper. This is the screen sequence of my setup: Here's how I set up my global.asax: <% @ Application Language="C#" %><% @ Import Namespace="MicroFour.StrataFrame.Data"%>< script runat="server">void Application_Start(Object sender, EventArgs e) {// Code that runs on application startup// ToDo: 1) Manually set the DataSourceItems on the DataSources collection below.// -- You can set as many data sources as necessary. The business objects use the data source specified// by their DataSourceKey property (defaults to "").//------------------------------------// Setting the data sources manually//------------------------------------//-- SQL Server//DataLayer.DataSources.Add(new SqlDataSourceItem("", "myconnectionstring"));//-- Oracle//DataLayer.DataSources.Add(new OracleDataSourceItem("", "myconnectionstring"));//-- Microsoft Access//DataLayer.DataSources.Add(new AccessDataSourceItem("", "myconnectionstring"));//-- Visual Fox ProDataLayer.DataSources.Add(new VfpDataSourceItem("VFPOLEDB", "C:\\CPW\\DATA\\CPW.DBC"));//Provider=VFPOLEDB;Data Source=C:\MyVfpPath\CPW.DBC; //-- Set the localization information for the websiteMicroFour.StrataFrame.UI. Localization.MessageDataSourceKey = "";MicroFour.StrataFrame.UI. Localization.MessageLocaleID = 1033;MicroFour.StrataFrame.UI. Localization.MessageKeyType = MicroFour.StrataFrame.Messaging.MessageKeyDataType.SqlServer;} void Application_End(Object sender, EventArgs e) {// Code that runs on application shutdown} void Application_Error(Object sender, EventArgs e) { // Code that runs when an unhandled error occurs} void Session_Start(Object sender, EventArgs e) {// Code that runs when a new session is started} void Session_End(Object sender, EventArgs e) {// Code that runs when a session ends. // Note: The Session_End event is raised only when the sessionstate mode// is set to InProc in the Web.config file. If session mode is set to StateServer // or SQLServer, the event is not raised.} </ script>
|
|
|
Pertti Karjalainen
|
|
Group: Forum Members
Posts: 54,
Visits: 4K
|
Oh, and btw, it doesn't seem to matter what I do with global.asax, because I suppose object mapper overwrites it or something. I've tried commenting out all datasources, uncommenting with and without parameters, etc. No use. Pertti
|
|
|
StrataFrame Team
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
The first parameter of the VfpDataSourceItem constructor is not the OLE DB provider, it is the unique DataSourceKey that is used to identify the data source (a data source is synonymous with "connection string"). The second parameter is the actual connection string. So, your code line to add the actual data source should look like this: DataLayer.DataSources.Add(VfpDataSourceItem("", "Provider=VFPOLEDB;Data Source=C:\\CPW\\DATA\\CPW.DBC;")); The first parameter should match the value that you place in the DataSourceKey property of your business objects. This property on the business objects tells them what connection string to use when communicating with the database. That property defaults to string.Empty (""), so that is why when you only have one data source, you leave the first parameter of the constructor as an empty string.
|
|
|
StrataFrame Team
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
Oh, and the connection string used within the BOMapper is only used to gather the structure information when the partial classes of the business objects are built. It it not used at runtime.
|
|
|
Pertti Karjalainen
|
|
Group: Forum Members
Posts: 54,
Visits: 4K
|
Ben, Thank you for your help here. I'm actually making some progress... I now have my "site" up again (well, if you can call it that when I have one read-only field with actual data coming in from a VFP table proudly displaying on my). A huge step for a man, a minute step for a mankind... Of course, I could'a had my VFP form like this up in about 15 seconds. And we call this progress? Granted, the VFP form by itself would not display in a browser (unless you use Terminal Services, of course, which gives you web AND rich AND snappy user interface experience all at once -- now THAT's progress). Is the below explained in the manual? I couldn't find any references for DataSourcekey even when I searched for the string itself in the help. Heck, I couldn't even find the string "DataSourceKey" anywhere in my project. This seems kind of a crucial step for those trying to get a web site with VFP data up and running, wouldn't you say? Or is this .NET knowledge we oughta to know regardless? Ben Chase (12/12/2006)
The first parameter of the VfpDataSourceItem constructor is not the OLE DB provider, it is the unique DataSourceKey that is used to identify the data source (a data source is synonymous with "connection string"). The second parameter is the actual connection string. So, your code line to add the actual data source should look like this: DataLayer.DataSources.Add(VfpDataSourceItem("", "Provider=VFPOLEDB;Data Source=C:\\CPW\\DATA\\CPW.DBC;")); The first parameter should match the value that you place in the DataSourceKey property of your business objects. This property on the business objects tells them what connection string to use when communicating with the database. That property defaults to string.Empty (""), so that is why when you only have one data source, you leave the first parameter of the constructor as an empty string.
|
|
|
StrataFrame Team
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
No, it's not really a ".NET" thing... it's just the way StrataFrame is configured. There is information within the help file on configuring your data sources within the Global.asax topic... Application -> WebForms -> Global.asax File Application -> WinForms -> AppMain.vb (program.cs) File -> SetDataSources() I'm not sure why you couldn't locate anything when you searched for "DataSourceKey"...
|
|
|