Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

use text file as a database for creating an images album project in C# language

Автор: ادد المطيري

Загружено: 2022-07-16

Просмотров: 128

Описание:

List Image Extentions
*.ai; *.bmp; *.gif; *.ico; *.jpeg; *.jpg; *.png; *.ps; *.psd; *.svd; *.tif; *.tiff

How to use txt file as a database in c#
C# Data Access: Text Files
C# - How To Import Text File Data Into Datagridview In C#
how to read, write, process txt file like database in c#
C# resuable library to treat a text file like a
c# - Read line by line from text file and save
How to read from database and write into
How to read data from text file and store in
C# Class: Text file as DataBase
Is a text file a database?
How do you create a text file in a database?
About using text file as database to store data
Use Visual C# to read from and write to a text file
how to read data from text file in c#


C# Class: Text file as DataBase
Renan Rodrigues Duarte

Introduction

I made this class to use on a Mobile Project (.net compact framework). I tried to use SQL Compact but it gets a lot of resources.
This article will try to show you some great features of Classes in C# and to get them you should have some basic knowledge of Csharp.
We are going to create a class that will provide us some pre-made functions to use a simple text file as a Database.
A simple explanation of classes:

"In object-oriented programming, a class is a programming language construct used to group related instance variables and methods.
A method (called a function in some languages) is a set of instructions specific to a class.
Depending on the language, classes may support multiple inheritance or may require interfaces to extend other classes.
A class may indicate either specifically or abstractly what methods exist when the program executes. The latter is known as an 'abstract class'.
A class must be defined with a constructor if used as an object that will be instantiated.
However, some classes, especially those containing factory methods, are defined as static classes with no constructor.
Instead, they merely organize data hierarchically (e.g. the Math class may contain the static constant PI and the static method abs)." (Wikipedia)

Conclusion:
If we are objects, the world would have a class called Persons with many functions and properties that describe us and we would be an object of this class =)
Creating the DataBase

The columns will be separated by ';' and we don't need to set ID reference because we are going to use line number as it.
So, one database with the fields Name, LastName, Phone, Mail and Website would be like:
Copy Code

Notice that We have to set the path and after that we should create a function that gets all the entries and fill another object like a ComboBox, ListView, etc.
P.s.:This should be easily done getting the number of entries DataText.Entries and after using While.
The Engine
All the records can be easily read using FileStream and StreamReader. After reading the line, you only need to split it (using ';' separator).
Then you have an Array with all the values of the line =)
The new entries will be added at the end of the file and to update one line, we will re-write all the database.
That's ok for me because I don't have many records. Otherwise we can save the text in another object which can treat better this problem.
Additional functions

We can set functions with the same name but with different parameters. Like:
Copy Code

public int ReadEntrie(int id, ref string name)

And we are going to get this result:

Many choices
Points of Interest

Setting functions with the same name should be great to get a specific variable variable like, only the name or only the mail.
This code gives you some experience with classes and this would be a start of making dll's and other components =)
I haven't made any bench with this class until now but it should be perfect for small databases.
License

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


source:-
https://www.codeproject.com/Articles/...

use text file as a database for creating an images album project in C# language

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

استخدام الملف النصي كقاعدة بيانات لمشروع البوم صور ضمن مشاريع تطبيقات الحاسوب بلغة السي شارب

استخدام الملف النصي كقاعدة بيانات لمشروع البوم صور ضمن مشاريع تطبيقات الحاسوب بلغة السي شارب

use text file as a database for creating an images album project - part -2- in C# language

use text file as a database for creating an images album project - part -2- in C# language

Use several types of fonts and colors and back color in the same rich text box  in C# language

Use several types of fonts and colors and back color in the same rich text box in C# language

Tutorial on creating desktop apps in C# language

Tutorial on creating desktop apps in C# language

use text file as a database for creating an images album project - part -1- in C# language

use text file as a database for creating an images album project - part -1- in C# language

حل المعادلات الخطية باستخدام خوارزمية التبسيط -Linear Programming - SimplexMethod - Maximize Z

حل المعادلات الخطية باستخدام خوارزمية التبسيط -Linear Programming - SimplexMethod - Maximize Z

Googles AI Boss Reveals What AI In 2026 Looks Like

Googles AI Boss Reveals What AI In 2026 Looks Like

tagesschau in Einfacher Sprache 19:00 Uhr, 12.12.2025

tagesschau in Einfacher Sprache 19:00 Uhr, 12.12.2025

Btvn 1

Btvn 1

Change Form Color with Multi Methods in c#-  Tutorial on creating desktop apps in C# language

Change Form Color with Multi Methods in c#- Tutorial on creating desktop apps in C# language

Register or Login | ASP.NET Core | #codewithasif

Register or Login | ASP.NET Core | #codewithasif

Frustracja społeczeństwa a

Frustracja społeczeństwa a "nadprodukcja elit". Ekspert wskazuje przyczyny

Wraca Zasadnicza Służba Wojskowa: Omawiam Szanse i Zagrożenia.

Wraca Zasadnicza Służba Wojskowa: Omawiam Szanse i Zagrożenia.

add distinct items to list check box from text file-Tutorial on creating desktop apps in C# language

add distinct items to list check box from text file-Tutorial on creating desktop apps in C# language

Sklepy z elektroniką w Chinach!

Sklepy z elektroniką w Chinach!

Google Antigravity: Build a Visual Network Mapper in 30 Mins

Google Antigravity: Build a Visual Network Mapper in 30 Mins

bai2 lap13

bai2 lap13

12 Stunden in Tunis 🇹🇳 | Authentisches DEUTSCH im Alltag B2 C1 C2 🇩🇪

12 Stunden in Tunis 🇹🇳 | Authentisches DEUTSCH im Alltag B2 C1 C2 🇩🇪

M13 - 13 - Prova de avaliação - n.º 2 - 1.ª parte

M13 - 13 - Prova de avaliação - n.º 2 - 1.ª parte

#658 Jak Unia chce ograć Orbana i Belgię. Odbudowa Ukrainy, Microsoft i Amazon inwestują w Indiach,

#658 Jak Unia chce ograć Orbana i Belgię. Odbudowa Ukrainy, Microsoft i Amazon inwestują w Indiach,

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]