Access data copy


Author
Message
Ian Hammond
Ian Hammond
StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)
Group: Forum Members
Posts: 57, Visits: 277
Hi,

I have deleted the connection.dat and appkeys.dat files to reset the connections wizard. I have changed my SetDataSources method to open an Access database. This seems to work fine. When I try to execute a FillCommand in my BO I get the exception:

InvalidCastException
  Unable to cast object of type 'System.Data.OleDb.OleDbConnection' to type 'System.Data.SqlClient.SqlConnection'.

Source     : System.Data

Stack Trace:
   at System.Data.SqlClient.SqlCommand.set_DbConnection(DbConnection value)
   at System.Data.Common.DbCommand.set_Connection(DbConnection value)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.DataLayer.GetDataTable(DbCommand Command, Boolean RegisterNotification)
   at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(DbCommand CommandToExecute)
   at ConfigHLS.DetailsBO.FillDetailsByTableId(Int32 tableId) in E:\HLS Pro.Net Development\ConfigHLS\BusinessObjects\DetailsBO.cs:line 87
   at ConfigHLS.Forms.DetailsForm.detailsBO1_ParentFormLoading() in E:\HLS Pro.Net Development\ConfigHLS\Forms\DetailsForm.cs:line 258
   at MicroFour.StrataFrame.Business.BusinessLayer.raise_ParentFormLoading()
   at MicroFour.StrataFrame.Business.BusinessLayer.OnParentFormLoading()
   at MicroFour.StrataFrame.Business.BusinessLayer.RaiseParentFormLoadingEvent()
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Am I using the Connections Wizard incorrectly.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Instead of using the connection wizard in your app just manually specify the connection. I don't think that you have your connection type setup as Access but rather SQL.



Remove the SetConnections() line and just add a manual connection string:



MicroFour.StrataFrame.Data.DataBasics.DataSources.Add(new AccessDataSourceItem(...))




But most likely, you have your required data source set to SQL Server instead of Access which is causing the issue.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search