Mariam,
Be sure VFPOLEDB is installed and registered there. You might quickly check it in many ways. ie: with a simple HTM
<html>
<title>Check VFP Table</title>
<body>
<script language="JScript">
function CheckTable(dbcPath,dbfName)
{
var strCn = "Provider=VFPOLEDB;Data Source=" + dbcPath;
var strSQL = "select * from " + dbfName;
var oConn = new ActiveXObject("Adodb.Connection");
oConn.ConnectionString = strCn;
oConn.Open;
var oRS = oConn.Execute(strSQL);
var lst="<TABLE border='1'><TR>";
var Maxfields=5;
var MaxRows=20;
for (i=0;i<Math.min(oRS.Fields.Count,Maxfields);i++)
{
lst += "<TH>";
lst += oRS.Fields(i).Name;
lst += "</TH>";
}
lst += "</TR>";
var counter=0;
while (!oRS.eof
{
lst += "<TR>";
for (i=0;i<Math.min(oRS.Fields.Count,Maxfields);i++)
{
lst += "<TD>";
lst += oRS.Fields(i).Value;
lst += "</TD>";
}
lst += "</TR>";
oRS.MoveNext();
counter++;
}
lst += "</TABLE>";
oConn.Close();
tablelist.innerHTML = lst;
return true;
}
</script>
<table>
<TR><TD>Locate DBC</TD><TD><input type='file' size='80' name='DBCLOCATION'></TD></TR>
<TR><TD>TableName</TD><TD><input type='text' size='80' name='TABLENAME'></TD></TR>
</TABLE><HR>
<input type='button' value='List' onClick="CheckTable(DBCLOCATION.value,TABLENAME.value);return;">
<div id='tablelist'></div>
</body>
</html>
With a udl.
-Create an empty file with extension .udl
-Dblclick the udl file
-Try to select VFPOLEDB from providers and creating a connection
Cetin
>Hello Cetin !
>I am sorry that I have to return to this question again, but I still have an unsolved issue.
>
>When I first used OPENROWSET method like this
>SELECT * FROM OPENROWSET('VFPOLEDB', 'C:\TEMP ';'';'','select * from test1.dbf')
>I got the error:
>“Ad hoc access to OLE DB provider ‘CustomOLEDBProvider ‘ has been denied. You must access this provider through a linked server”.
>In MS KB I found the article # 328569 which gave the solution for this problem - to install the service pack for MS SQL Server. After the installation SP3 (check that DissallowAdHocAccess key exists) I got another message for the same action:
>“Could not create an instance of OLE DB provider 'VFPOLEDB'.
>OLE DB error trace [Non-interface error: CoCreate of DSO for VFPOLEDB returned 0x80040154]. “
>
>I tried the same action on my local computer, where I have another copy of MS SQL Server- it works fine.
>(I have Windows XP on my computer, and Windows NT on our main server. )
>
>I am wondering may be you know what the a problem here, what else I have to check or install ?
>
>Thank you very much,
>Mariam
>
>
>>Mariam,
>>Why are you using MSDASQL. It's a wrapper driver for ODBC. Directly use VFPOLEDB driver (BTW MSDASQL works too). ie:
>>
>>* lnHandle is ready
>>text to m.lcSQL textmerge noshow
>>insert into myTable ;
>> SELECT * FROM
>> OPENROWSET('VFPOLEDB',
>> '<<_samples+"data\testdata.dbc">>';'';'',
>> 'select * from orditems')
>>endtext
>>SQLExec(m.lnHandle,m.lcSQL)
>>
Cetin
>>
>>>Thank you for help.
>>>i try to use OpenRowSet() but have a error message
>>>
>>>1)
>>>exec sp_addlinkedserver @server=N'CSTSERVER',
>>>@srvproduct ='',
>>>@provider = N'MSDASQL',
>>>@datasrc=N'DBF'
>>>2)
>>>exec sp_addlinkedsrvlogin @rmtsrvname=N'CSTSERVER',
>>>@useself = N'FALSE',
>>>@locallogin = NULL,
>>>@rmtuser = N'',
>>>@rmtpassword =N''
>>>
>>>first two work fine
>>>
>>>3)
>>>select * from [CSTSERVER].[Q:\FPDEV\COMMON\sqlappinspect]..[helpdb]
>>>
>>>here i have an error
>>>OLE DB provider 'MSDASQL' reported an error.
>>>[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified]
>>>OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitialize::Initialize returned 0x80004005: ].
>>>
>>>
>>>
>>>>>Hello All !
>>>>>I have VFP 8.0/SQL Server SPT application.
>>>>>I'm wondering is there any way to use BULK INSERT command for loading
DBF file into a SQL Server table ? All examples I've seen were about loading text files and not the DBF.
>>>>>TIA
>>>>>Mariam
>>>>
>>>>Mariam,
>>>>It's because dbf files do not need BULK INSERT command. See OpenRowSet() - or search here for samples.
>>>>Cetin