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

Recommended Answers

All 4 Replies

hi,
do u have any folder in which u save the txt files,r from database.

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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.