2010-08-26 50 views
0

我非常非常沉迷於此,非常感謝幫助。 我想要做什麼?鏈接服務器「(null)」的OLE DB提供程序「MSDASQL」報告了一個錯誤

有一個ASP頁(經典的ASP)使用CSV上傳的是提供了以下錯誤:

Microsoft OLE DB Provider for SQL Server error '80040e14' 

The OLE DB provider "MSDASQL" for linked server "(null)" reported an error. The provider did not give any information about the error. 

/ùùù.stocklist.be/importCSVProcess.asp, line 86 

我已經創建了兩個鏈接的服務器:

EXEC master.dbo.sp_addlinkedserver 
      @server = N'txtsrv' 
     , @srvproduct=N'Jet 4.0' 
     , @provider=N'Microsoft Text Driver (*.txt; *.csv)' 
     , @datasrc=N'D:\WEBSITES\ùùù.stocklist.be\csv\upload' 
     , @provstr=N'Text' 

  EXEC sp_addlinkedserver 
    @server = 'Server1', 
    @srvproduct = '', 
    @provider = 'MSDASQL', 
    @datasrc = ' 

'

當我在下面的查詢代替MSDASQL通過txtsrv我得到這個錯誤:

The OLE DB provider "txtsrv" has not been registered. 

這是插入完成代碼:年底

If upl.Form("rdbType") = "lot" Then 
      updFileNameSQL ="insert into cos_lot(lot_vin) " & _ 
        "SELECT vin " & _ 
        "FROM OPENROWSET " & _ 
        "('MSDASQL', " & _ 
        "'Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=" & sServerPath & ";', " & _ 
        "'SELECT vin from " & UplFileName & "') " & _ 
        "where not vin IS NULL AND vin collate SQL_Latin1_General_CP1_CI_AS not in (select lot_vin from cos_lot) " 


    Set updCmd = Server.CreateObject("ADODB.Command") 
     updCmd.ActiveConnection = MM_COS_STRING 
     updCmd.CommandText = updFileNameSQL 
     updCmd.Execute 
ElseIf upl.Form("rdbType") = "premie" Then 
    updFileNameSQL ="INSERT INTO [ùùùSTOCKLIST].[dbo].[COS_ANNEX] " & _ 
         "([annex_type] " & _ 
         ",[annex_chassisnr] " & _ 
         ",[annex_datum] " & _ 
         ",[annex_userid] " & _ 
         ",[annex_stockid] " & _ 
         ",[annex_commentNL] " & _ 
         ",[annex_commentFR] " & _ 
         ",[annex_premie] " & _ 
         ",[annex_premie_type] " & _ 
         ",[annex_consignatie] " & _ 
         ",[annex_eindeconsignatie] " & _ 
         ",[annex_online] " & _ 
         ",[annex_onlinefrom] " & _ 
         ",[annex_onlineto] " & _ 
         ",[annex_libelle]) " & _ 
         "SELECT 2 " & _ 
         ",[VIN] " & _ 
         ",Getdate() " & _ 
         ", " & Session("user_id") & " " & _ 
         ",[STOCK] " & _ 
         ",'' " & _ 
         ",'' " & _ 
         ",Replace([PREMIE],',','.') " & _ 
         ",'E' " & _ 
         ",Null " & _ 
         ",Null " & _ 
         ",1 " & _ 
         ",cast([ONLINEFROM] as smalldatetime) " & _ 
         ",cast([ONLINETO] as smalldatetime) " & _ 
         ",[TYPE] " & _ 
         "FROM OPENROWSET " & _ 
         "('MSDASQL', " & _ 
         "'Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=" & sServerPath & ";', " & _ 
         "'SELECT vin,stock,type,premie,onlinefrom,onlineto from " & UplFileName & "') " & _ 
         "WHERE NOT VIN IS NULL " 

    Set updCmd = Server.CreateObject("ADODB.Command") 
     updCmd.ActiveConnection = MM_COS_STRING 
     updCmd.CommandText = updFileNameSQL 
     updCmd.Execute 
End If 

updCmd.Execute我得到上述錯誤。

我會做什麼錯?

在此先感謝!

PS:服務器是Win2003的R2 x86的

回答

1

我不知道這將是值得嘗試不同的連接字符串?

updFileNameSQL ="insert into cos_lot(lot_vin) " & _ 
    "SELECT vin " & _ 
    "FROM OPENROWSET " & _ 
    "('Microsoft.Jet.OLEDB.4.0'," & _ 
    "'Text;HDR=Yes;FMT=Delimited;DATABASE=" & sServerPath & ";'," & _ 
    "'SELECT vin from [" & UplFileName & "]') " & _ 
    "where not vin IS NULL AND vin collate SQL_Latin1_General_CP1_CI_AS " & _ 
    "not in (select lot_vin from cos_lot) " 
相關問題