Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Sir,
Plz give me reply
suppose i want to add question and answer in notepad then this file access in c#.net2008
without using any database connection then how to add.
plz give me reply as early as possible.



Thanks & Regards
Sarika Nikam
Posted
Comments
Maciej Los 27-Jun-13 2:35am    
???
I don't get you. What are you trying to achive? Do you want to create chat, quiz in ASP.NET?
Ankur\m/ 27-Jun-13 2:40am    
What does accessing a file have to do with database connection? Both are different ways to store data. Using databases you can store data in a much structured manner and it has much more flexibility in accessing them. Text files should be used only when you have a very simple data to store.
MuhammadUSman1 27-Jun-13 6:47am    
Do you want to read file text and perform required action?
MuhammadUSman1 27-Jun-13 6:50am    
If you want to read file text. then check my solution

My answer is based on the assumption that you have a text file from which you want to read and display the contents.

Few sample for same are available here.

http://msdn.microsoft.com/en-us/library/vstudio/ezwyzy7b.aspx[^]
http://msdn.microsoft.com/en-us/library/aa287534(v=vs.71).aspx[^]

If you not intrested in haveing datasource my suggestion is to us XML as it will be much easier to extract data and its easier to manage questions and answers.
 
Share this answer
 
if you just want to read file text. then try following line

include
using System.IO;
C#
string sFileText = File.ReadAllText("your file path here");


sFileText contain all text of your give path text file, you can perform your task using sFileText
 
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