0

I want to upload a text file and get the data of that text file into a table of database . I m using Sql Server 2000 , and working in c#. kindly can you help me doing this and if possible can you give me the code for this

3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by Jugortha
0

Use Control called "Upload File" in Web-Based application (ASP.NET) then read uploaded file save its text into DB.

0

thanks for the reply i have uploaded the text file but i cannot download the data of that text file into the table of my database . kindly can you tell me how to read the data of the text file from internet and save its data into database .

0

You've the file in your hand, use File.ReadAllText("FilePathOnYourServer") which returns string, take it and using Insert statement your string'll be in your DB.

0

sir I uploaded the file using vb . But I wanna upload using C# .I m writing the following code private void btnUpload_Click(object sender, EventArgs e)

{
            WebClient Client = new WebClient();
            Client.UploadFile("http://localhost/imp.txt","C:\\Documents and Settings\\Maverick\\Desktop\\imp.txt");
        }

but an error message is comming

"The remote server returned an error: (405) Method Not Allowed."
kindly tell me what to do

Edited by happygeek: fixed formatting

0

Check the credential and permissions to do server calls, you can modifiy or add creadentials attributes into the server side method to avoid such trouble

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.