Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear EXPERTS !!

Am unable to understand what to do with this problem.

I have a Project on Railway System.

Daily I will recieve the text files in .txt

I have made a program to upload the data from notepad to SqlServer Database. and finally it is displaying in gridview. when i click the Upload button.

Now i need to upload the data from notepad to sqlserver and it must display in Gridview WITHOUT UPLOAD BUTTON CLICK.

Please can you help me this problem.

I need it Automatically...Daily it should convert txt file into sqlserver DB and display in GRIDVIEW.

Thanks.
Posted
Comments
Zoltán Zörgő 19-May-12 1:39am    
How your program " to upload the data from notepad to SqlServer Database" works exactly?

Actually a normal upload sequence looks like this:
1) create your file to upload (in notepad or whatever), and save it to disk
2) in your asp.net app there is a form with a file input, where you browse for your file
3) you post the form
4) the server-side will process your uploaded data, and show you the populated grid

I suppose you have an other sequence, but not clear, what.
Ranjith Reddy CSE 19-May-12 1:59am    
I have created a stored procedure, and finally wrote code to button click event to upload the data.....its working fine...BUt i need it automatically, without button click.
Sunny_Kumar_ 19-May-12 2:52am    
Automatically means... at which time... or on any specific event? Do you want it to be uploaded every moment or is there any specific time to get this text file uploaded. Please clarify :)
Zoltán Zörgő 19-May-12 4:03am    
Please, give us only relevant information so we can help you, irrelevant ones will mislead us, since we can not read your mind...
Ranjith Reddy CSE 19-May-12 5:42am    
Actually i will recieve the txt file at 7:00 Am....it should upload automatically at 8:00 Am

Hai,
For daily running task you can create a job in sql server it will automatically run daily or whatever you setting.

create a ssis project to import data from text files to sql server and convert it into package after that assign tat package in sql server job.. rrefer this links


http://www.quackit.com/sql_server/tutorial/sql_server_agent_jobs.cfm[^]

SQL Server Integration Services (SSIS) – Part 1: Basics of SSIS and Creating Packages[^]
 
Share this answer
 
How exactly do you receive this data?
- You could create a dedicated email address, and a small service that check that mailbox, and if a mail with those data arrives, after verifying it's liability, could process it.
- If your data provider is able to provide you the data this way, you could fetch your data from an external url from time to time, and process it.

This would be a real automatism in your case. But I dont know how you imagine your automatism.

You want to automatically post the form on the page right after you selected the file? Than you can use JavaScript like here:
XML
<form action="upload.php" method="post">
<input type="file" onchange="this.form.submit()" name="myFile"/>
</form>
 
Share this answer
 
I don't know how you upload data, upload the .txt file or the Text inside it?
if you're sending the text inside, You can Use a Windows Service, Define a timer and check for new .txt files,use File.ReadAllText and store it into your Database.
if you tell more details we can help you more
 
Share this answer
 
Comments
Ranjith Reddy CSE 19-May-12 5:44am    
Boss Everthing is running fine. But the problem here is...i dont want to click upload button to upload the data...i.ll recieve the data at 7:00Am ..it should be done automaticaly at 8:00 Am.
Zoltán Zörgő 19-May-12 8:57am    
What do you want exactly?
1) write/modify an application yourself that waits for the data to arrive somehow, than processes it, and shows the result in a gridview?
or
2) an appllcation that makes this "click" on a button for you in a form of an existing asp.net application written by somebody? Eg: you want to automate the browser.

Dude, we need the technical details of your problem, not your wishes - we are not Santa.
mahdi87_gh 19-May-12 7:48am    
where are you getting this .txt file?in a folder or an email?
the service will be running always, it should check for new data and upload it to server and backup data to a new place and delete it. to don't send it again. of course you should give me more information about how you receive it and how you want to upload it
You can create a windows service which will execute at specified time, which will call your upload function from the specified page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900