0

現在、csvファイルをdevexpress gridviewにインポートする際に問題に直面しています。コードを実行すると、次のエラーが表示'C:\New folder\QtimeAutomotiveByLot_new.csv' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.され、ファイルパスは私の側で完全に機能します。私のコードは次のとおりです。誰かがこれについて私を案内できますか?

asp.net

<dx:ASPxGridView ID="DetailGridx" runat="server"  OnDataBinding="DetailGridx_DataBinding">

vb.net

  Protected Sub DetailGridx_DataBinding(sender As Object, e As EventArgs)

        Dim dt1 As New DataTable()
        Dim csvFileFolder As String = "C:\New folder\QtimeAutomotiveByLot_New.csv"
        'Dim csvFile As String = "QtimeAutomotiveByLot_New.csv"
        Dim strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + csvFileFolder + ";Extended Properties='Text;HDR=YES;IMEX=1;';"
        Dim connx As New OleDbConnection(strCon)
        Dim adapter1 As New OleDbDataAdapter
        connx.Open()

        Dim sql As New OleDbCommand("Select * FROM [" + csvFileFolder + "]", connx)

        adapter1.SelectCommand = sql

        adapter1.Fill(dt1)

        connx.Close()

        Dim detailGrid As ASPxGridView = CType(sender, ASPxGridView)
        Dim RowLotID As String = TryCast(sender, ASPxGridView).GetMasterRowFieldValues("LOTID")
        Dim ddata As DataView = New DataView(dt1)
        ddata.RowFilter = "LOTID = '" + RowLotID + "'"
        detailGrid.DataSource = ddata
        detailGrid.DataBind()

    End Sub
4

1 に答える 1