Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gorovdude

@gorovdude
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ASP C# WebSite to load a simple CSV File
    G gorovdude

    how?

    C# sysadmin csharp help

  • ASP C# WebSite to load a simple CSV File
    G gorovdude

    Hi All, I want to have an ASP C# WebSite that loads a simple CSV File and present it in a GridView control (at least for a start). I already have a piece of code that do almost all of the work, what i miss / unable to make it work is setting correctly the "Data Source". The CSV file that I want to load is located on different server in the network (path is "\\td47vc\public\Joe\ASP\Test"). Here is the code I wrote:

    public DataSet GetCSVFile(string fileName)
    {
    
        string pathName = "\\\\td47vc\\\\public\\\\Joe\\\\ASP\\\\Test";
        string file = System.IO.Path.GetFileName(fileName);
        OleDbConnection excelConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathName + ";Extended Properties=Text;");
        OleDbCommand excelCommand = new OleDbCommand(@"SELECT \* FROM " + file, excelConnection);
        OleDbDataAdapter excelAdapter = new OleDbDataAdapter(excelCommand);
        excelConnection.Open();
        DataSet ds = new DataSet();
        excelAdapter.Fill(ds);
        excelConnection.Close();
        return ds;
    }
    

    I get the following error:

    '\\td47vc\public\Joe\ASP\Test' 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.

    Thanks, GorovDude

    C# sysadmin csharp help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups