StrataFrame Forum

Using Visual FoxPro free table with SF Controls

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

By Elio Reyes - 9/17/2008

Hi



The last object I used was the BrowseDialog and sent me the next error referring to dbo not to the free table directory.



SqlException

Invalid object name 'dbo.spmarcf0'.



Source : .Net SqlClient Data Provider



Stack Trace:

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

at System.Data.SqlClient.SqlDataReader.get_MetaData()

at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)

at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)

at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)

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(QueryInformation QueryInfo, OnChangeEventHandler CallBack)

at MicroFour.StrataFrame.Data.DataLayer.GetDataTable(QueryInformation QueryInfo, Boolean RegisterNotification)

at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(QueryInformation QueryInfo)

at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.Search(WhereStatementCollection WhereStatements)

at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.ExecuteSearch()

at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.ProcessCmdKey(Message& msg, Keys keyData)

at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)

at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)

at System.Windows.Forms.TextBoxBase.ProcessCmdKey(Message& msg, Keys keyData)

at System.Windows.Forms.MaskedTextBox.ProcessCmdKey(Message& msg, Keys keyData)

at System.Windows.Forms.Control.PreProcessMessage(Message& msg)

at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)

at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)





Thanks SF


By Trent L. Taylor - 9/17/2008

Well, it thinks that you BO is a SQL database.  First, ensure that your DataSources are setup to use a VfpDataSourceItem within the SetDataSources method of the Appmain.  The BrowseDialog uses the data source to determine what type of query object to build...and it thinks that this is an SqlDataSourceItem...thus it is trying to use an SqlCommand.
By Elio Reyes - 9/17/2008

This is the Conection creation code



ConnectionManager.AddRequiredDataSourceItem("CigarrosII", "2.-Conexión SPMARCF0", _

DataSourceTypeOptions.VisualFoxPro, "F:\IDBSIST\CIDAV\SPMARCF0.DBF", "Esta conexión se utiliza para las vitolas (SPMARCF0)")
By Trent L. Taylor - 9/17/2008

Do you have the DataSOurceKey on the BO set to "CigarrosII"?
By Elio Reyes - 9/18/2008

Yes, I Have
By Ivan George Borges - 9/18/2008

Hi Pedro.

Instead of using the Connection Manager, have you tried setting the data source manually, as I had showed you before?

DataLayer.DataSources.Add(New VfpDataSourceItem("CigarrosII", "Provider=vfpoledb.1;Data Source="F:\IDBSIST\CIDAV";Collating Sequence=general;"))
By Elio Reyes - 9/18/2008

I used in that way but send me the same error, I know the connection is good, because if I use the command seek to find something, works very nice.



Thanks SF
By Ivan George Borges - 9/18/2008

In your BrowseDialog, did you set the OrderBy property?
By Elio Reyes - 9/18/2008

No



This works very nice ....



If Me.Cigarro1.Seek("codmarc=" & CodMarc.Text) Then

Me.DesMarc.Text = Me.Cigarro1.desmarc

Me.Refresh()

Else

Me.DesMarc.Text = ""

End If





But combox, listbox, BrowDialog does not work ...




By Trent L. Taylor - 9/18/2008

Pedro, I think that we are having a hard time undestanding your code as this is a very basic and simple process.  SO there is some piece of information that is being left out here which is making it difficult for us to help you diagnose your problem.  I think that this point it would be best for you to put together a simple sample reproducing your problem...and then we can go from there.
By Elio Reyes - 9/23/2008

Sorry for my bad explanation, I would try to reproduce the error better, I suppose that I for better information a video is the better way.



Tell me how to put it here .. o I can send you my project if you prefer.



Please tell me.



Thanks a Lot.
By Trent L. Taylor - 9/23/2008

Just post it as an attachment.
By Elio Reyes - 9/23/2008

Here's the project



Thanks in advanced
By Ivan George Borges - 9/23/2008

Hi Pedro.

Open your Cigarro business object in the designer and have a look at the DataSourceKey property... you haven't set it to CigarrosII.

By Elio Reyes - 9/23/2008

Sorry ... sorry sorry, I apologize we you, I misunderstood when you tell me to fill this property .. I put it in a wrong place.



I send you a picture illustrating my mistake....



I hope you can apologize me



Thanks a Lot



Note: I never think is a SF error, just I don't knew where is my error.
By Ivan George Borges - 9/23/2008

Hey, don't worry Pedro!

Glad you got it going. Wink

Another thing, on your BuscarCigarros BrowseDialog, you may want to set the OrderBy property, since you are using an OLE DB connection.

By Elio Reyes - 9/23/2008

Perfect ... all is working Excellent





Thanks a Lot
By Ivan George Borges - 9/23/2008

Great, glad to hear that Pedro. Cool