0

hi friends
i have to store and read .txt files from database(sqlserver 2005) using asp.net 2.0
and i m unable to do that
plzz reply me as soon as possible

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by dvlpr30062
0

hi
first of all thanx for being there to help me out..
actually my main problem is that i have to read a txt file stored somewhere in my computer and its path is specified in the database
i dnt know how read this using asp.net 2.0
plzz help me

0

You may want to try something like this:

public void Button1_OnClick(object sender, EventArgs e)
    { 

        string path = TextBox1.Text.ToString();
        string file = TextBox2.Text.ToString();
        DirectoryInfo dir = new DirectoryInfo(path);
        FileInfo[] bmpfiles = dir.GetFiles(file);
        foreach( FileInfo f in bmpfiles)
        {
            //add what you need to do with the file when found
            Label1.Text = "File Found";
        }
    }

I am reading from text boxes, in a similar fashion I think you can read from a database through your database connection, etc. This does require "using System.IO;"

I hope this helps.

0

I forgot to mention that I did this in C# on the aspx.cs.

I am sure it can be translated to another language if C# is not the language of preference.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.