Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing DBF tables from .Net
Message
 
 
To
16/11/2010 13:30:32
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01489220
Message ID:
01489229
Views:
52
Try creating a connection string first. Looks like the errors came from the connection string, not even from Execute.

>This part is from another developer on the project, and I posted it here to try to help him.
>
>Looking at the error messages returned, they are .Net errors, and the SQL that I posted is the SQL string that is used in the ADO.Net sql execute statement.
>
>
>>>I'm using ADO.NET to query FoxPro tables. I'm trying to join two tables that are in different folders. Here is the query I'm trying to run.
>>>
>>>
>>>SELECT fca.id_num AS [Id Number], 
>>>       CAST(fca.sequence * 6 AS VARCHAR) + ' MONTH' AS [Description],
>>>       fca.datesent AS [Sent To Cati], 
>>>       fcm.fudate AS [Received From Cati]
>>>  FROM \\MyServer\g$\filestosurveyunit\followup\followup_sent_to_cati_all AS fca 
>>>  LEFT OUTER JOIN \\MyServer\g$\filesfromsurveyunit\followup\followup_from_cati_main AS fcm ON fca.id_num = fcm.ident
>>> WHERE fca.id_num = ?
>>>
>>>
>>>I keep getting this error though.
>>>
>>>
>>>System.InvalidOperationException: Fill: SelectCommand.Connection property has not been initialized.
>>>   at System.Data.Common.DbDataAdapter.GetConnection3(DbDataAdapter adapter, IDbCommand command, String method)
>>>   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(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
>>>   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
>>>   at DataAccess.DBUtility.cls_soph_db_util.get_data_set(String str_select) in C:\Progs\Regards\RegardsDesktop\DataAccess\cls_soph_db_util.vb:line 688
>>>   at DataAccess.DBUtility.clsParticipantInformation.GetDataSetByParticipantId(String strParticipantId, String strSQL, DataSet& dsData, enConnectionStringFolder oFolder, String& strErrMsg) in C:\Progs\Regards\RegardsDesktop\DataAccess\clsParticipantInformationDbOps.vb:line 411
>>>
>>>
>>>The real pain is that the test system using UNCs while the production system uses mounted drives. So, while relative paths would work on the test system, they would not work on the production system.
>>>
>>>
>>>.
>>Your select statement doesn't make sense. Are you creating it for SQL Server or for VFP? In second case, try using " " around the full path for the tables. In other words:
>>
>>
>>SELECT fca.id_num AS [Id Number], 
>>>       CAST(fca.sequence * 6 AS VARCHAR) + ' MONTH' AS [Description],
>>>       fca.datesent AS [Sent To Cati], 
>>>       fcm.fudate AS [Received From Cati]
>>>  FROM "\\MyServer\g$\filestosurveyunit\followup\followup_sent_to_cati_all.dbf" AS fca 
>> LEFT OUTER JOIN "\\MyServer\g$\filesfromsurveyunit\followup\followup_from_cati_main.dbf" AS fcm ON fca.id_num = fcm.ident
>> WHERE fca.id_num = ?
>>
>>Also, I'm not sure about spaces in the field names. Try making it work without the spaces for now.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform