{"id":15003319,"url":"https://github.com/ashfaqalizardariofficial/databasehelper","last_synced_at":"2026-04-02T01:57:57.251Z","repository":{"id":45969753,"uuid":"431083402","full_name":"AshfaqAliZardariOfficial/DatabaseHelper","owner":"AshfaqAliZardariOfficial","description":"A C# database helper library to connect with the database server and perform actions insert, update, delete, select data and select multiple data from the database.","archived":false,"fork":false,"pushed_at":"2022-07-19T15:13:38.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-18T14:22:17.725Z","etag":null,"topics":["ashfaq-ali-zardari","ashfaq-ali-zardari-official","data","database","delete","helper","insert","ms-sql-server","multiple","select-data","server","sql-server","update"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AshfaqAliZardariOfficial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"ashfaqalizardari","open_collective":null,"ko_fi":"ashfaqalizardari","tidelift":null,"community_bridge":null,"liberapay":"ashfaqalizardari","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.paypal.me/AshfaqAliZardari247"]}},"created_at":"2021-11-23T12:00:38.000Z","updated_at":"2021-11-23T14:34:25.000Z","dependencies_parsed_at":"2022-08-26T09:21:17.550Z","dependency_job_id":null,"html_url":"https://github.com/AshfaqAliZardariOfficial/DatabaseHelper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshfaqAliZardariOfficial%2FDatabaseHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshfaqAliZardariOfficial%2FDatabaseHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshfaqAliZardariOfficial%2FDatabaseHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshfaqAliZardariOfficial%2FDatabaseHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AshfaqAliZardariOfficial","download_url":"https://codeload.github.com/AshfaqAliZardariOfficial/DatabaseHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243154743,"owners_count":20244985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ashfaq-ali-zardari","ashfaq-ali-zardari-official","data","database","delete","helper","insert","ms-sql-server","multiple","select-data","server","sql-server","update"],"created_at":"2024-09-24T18:57:58.846Z","updated_at":"2025-12-26T05:03:29.646Z","avatar_url":"https://github.com/AshfaqAliZardariOfficial.png","language":"C#","funding_links":["https://patreon.com/ashfaqalizardari","https://ko-fi.com/ashfaqalizardari","https://liberapay.com/ashfaqalizardari","https://www.paypal.me/AshfaqAliZardari247","https://paypal.me/ashfaqalizardari247?country.x=CA\u0026locale.x=en_US","https://www.buymeacoffee.com/ashfaqalizardari"],"categories":[],"sub_categories":[],"readme":"# DatabaseHelper\n A C# database helper library to connect with database server and perform actions insert, update, delete, select data and select multiple data from database.\n\n## [Install Package](https://www.nuget.org/packages/AshfaqAliZardariOfficial.Util.DatabaseHelper/)\n\u003e ##### Using Package Manager\n\u003e ```\n\u003e Install-Package AshfaqAliZardariOfficial.Util.DatabaseHelper -Version 1.0.0\n\u003e ```\n\u003e ##### Using .NET CLI\n\u003e \n\u003e ```\n\u003e dotnet add package AshfaqAliZardariOfficial.Util.DatabaseHelper --version 1.0.0\n\u003e ```\n\u003e ##### Using PackageReference\n\u003e \n\u003e ```\n\u003e \u003cPackageReference Include=\"AshfaqAliZardariOfficial.Util.DatabaseHelper\" Version=\"1.0.0\" /\u003e\n\u003e ```\n\u003e ##### Using Paket CLI\n\u003e ```\n\u003e paket add AshfaqAliZardariOfficial.Util.DatabaseHelper --version 1.0.0\n\u003e ```\n\u003e ##### Using Script \u0026 Interactive\n\u003e ```\n\u003e #r \"nuget: AshfaqAliZardariOfficial.Util.DatabaseHelper, 1.0.0\"\n\u003e ```\n\u003e ##### Using Cake\n\u003e ```\n\u003e // Install AshfaqAliZardariOfficial.Util.DatabaseHelper as a Cake Addin\n\u003e #addin nuget:?package=AshfaqAliZardariOfficial.Util.DatabaseHelper\u0026version=1.0.0\n\u003e \n\u003e // Install AshfaqAliZardariOfficial.Util.DatabaseHelper as a Cake Tool\n\u003e #tool nuget:?package=AshfaqAliZardariOfficial.Util.DatabaseHelper\u0026version=1.0.0\n\u003e ```\n\n## How do I use\n##### Connect with MS Sql Database Server.\n```csharp\n// Add Namespace\nusing DatabaseHelper;\n\n// MS Sql Database Server connection string.\nstring MsSqlCon = \"Server=.; Database=MyDatabase;User ID=sa;Password=1234;\";\n\n// Init database server connection.\nConnect DBHelper = new Connect(server: Connect.DB_SERVERS.SQL_SERVER, connectionString: MsSqlCon);\n```\n\n##### Connect with MySql Database Server.\n```csharp\n// Add Namespace\nusing DatabaseHelper;\n\n// MySql Database Server connection string.\nstring MySqlCon = @\"Server=localhost; Database=MyDatabase;User ID=root;Password=;\";\n\n// Init database server connection.\nConnect DBHelper = new Connect(server: Connect.DB_SERVERS.MYSQL_SERVER, connectionString: MySqlCon);\n```\n\n##### Insert data.\n```csharp\n// Insert query.\nstring query = \"insert into users(name, email) values(@name, @email)\";\n\n// Query parameters.\nIDictionary\u003cstring, object\u003e parameters = new Dictionary\u003cstring, object\u003e(); // Your dictionary object.\nparameters.Add(\"name\", \"Ashfaq Ali Zardari\"); // Your dictionary key value.\nparameters.Add(\"email\", \"ashfaqalizardariofficial@gmail.com\"); // Your dictionary key value.\n\n// return true, if data inserted. Otherwise return false.\nbool IsDataInserted = DBHelper.InsertOrUpdateOrDeleteData(query, parameters);\n```\n\n##### Update data.\n```csharp\n// Update query.\nstring query = \"update users set name = coalesce(@name, users.name), email = coalesce(@email, users.email) where id = @id\";\n\n// Query parameters.\nIDictionary\u003cstring, object\u003e parameters = new Dictionary\u003cstring, object\u003e(); // Your dictionary object.\nparameters.Add(\"name\", \"Ashfaq Ali Zardari Official\"); // Your dictionary key value.\nparameters.Add(\"email\", \"ashfaqalizardariofficial@outlook.com\"); // Your dictionary key value.\nparameters.Add(\"id\", 1); // Your dictionary key value.\n\n// return true, if data updated. Otherwise return false.\nbool IsDataUpdated = DBHelper.InsertOrUpdateOrDeleteData(query, parameters);\n```\n\n##### Delete data.\n```csharp\n// Delete query.\nstring query = \"delete from users where id = @id\";\n\n// Query parameters.\nIDictionary\u003cstring, object\u003e parameters = new Dictionary\u003cstring, object\u003e(); // Your dictionary object.\nparameters.Add(\"id\", 1); // Your dictionary key value.\n\n// return true, if data deleted. Otherwise return false.\nbool IsDataDeleted = DBHelper.InsertOrUpdateOrDeleteData(query, parameters);\n```\n\n##### Select data.\n```csharp\n// Select query.\nstring query = \"select * from users\";\n\n// return DataTable, if data selected. Otherwise return null.\nDataTable UsersTable = DBHelper.GetData(query, null);\n```\n\nOptional\n```csharp\n// Select query with parameters.\nstring query = \"select * from users where id = @id\";\n\n// Query parameters.\nIDictionary\u003cstring, object\u003e parameters = new Dictionary\u003cstring, object\u003e(); // Your dictionary object.\nparameters.Add(\"id\", 1); // Your dictionary key value.\n\n// return DataTable, if data selected. Otherwise return null.\nDataTable UsersTable = DBHelper.GetData(query, parameters);\n```\n\n##### Select multiple data (Two or more tables data).\n```csharp\n// Select multiple data query.\nstring query = \"select * from users; select * from roles;\";\n\n// return DataSet, if data selected. Otherwise return null.\nDataSet TablesDataSet = DBHelper.GetMultipleData(query, null);\n\n// Users DataTable.\nDataTable UsersTable = TablesDataSet != null \u0026\u0026 TablesDataSet.Tables[0] != null ? TablesDataSet.Tables[0] : null;\n\n// Roles DataTable.\nDataTable RolesTable = TablesDataSet != null \u0026\u0026 TablesDataSet.Tables[1] != null ? TablesDataSet.Tables[1] : null;\n```\n\nOptional\n```csharp\n// Select multiple data with parameters query.\nstring query = \"select * from users id = @userid; select * from roles where role = @role;\";\n\n// Queries parameters.\nIDictionary\u003cstring, object\u003e parameters = new Dictionary\u003cstring, object\u003e(); // Your dictionary object.\nparameters.Add(\"userid\", 1); // Your dictionary key value.\nparameters.Add(\"role\", \"Admin\"); // Your dictionary key value.\n\n// return DataSet, if data selected. Otherwise return null.\nDataSet TablesDataSet = DBHelper.GetMultipleData(query, parameters);\n\n// Users DataTable.\nDataTable UsersTable = TablesDataSet != null \u0026\u0026 TablesDataSet.Tables[0] != null ? TablesDataSet.Tables[0] : null;\n\n// Roles DataTable.\nDataTable RolesTable = TablesDataSet != null \u0026\u0026 TablesDataSet.Tables[1] != null ? TablesDataSet.Tables[1] : null;\n```\n\n## :clock3: Versions\n| Version | Last updated |\n| --- | --- |\n| [1.0.0](https://www.nuget.org/packages/AshfaqAliZardariOfficial.Util.DatabaseHelper/1.0.0) | Nov 23, 2021, 5:35 PM GMT+5 |\n\n## :book: Release Notes\n**v1.0.0**\n- Connect with MS Sql Database Server.\n- Connect with MySql Database Server.\n- Insert data.\n- Update data.\n- Delete data.\n- Select data.\n- Select Multiple data.\n## Contact and Supporting Info\nFeel free to contact me on \u003ca href=\"mailto:ashfaqalizardariofficial@gmail.com\" target=\"_blank\" title=\"ashfaqalizardariofficial@gmail.com\"\u003e\u003cimg src=\"https://ssl.gstatic.com/ui/v1/icons/mail/rfr/logo_gmail_lockup_default_1x_r2.png\" alt=\"ashfaqalizardariofficial@gmail.com\" width=\"70\" /\u003e\u003c/a\u003e  \n  \n  ## Support Me\n[//]: # (\u003ca href=\"https://paypal.me/ashfaqalizardari247?country.x=CA\u0026locale.x=en_US\" target=\"_blank\" title=\"paypal.me/ashfaqalizardari247\"\u003e\u003cimg src=\"https://www.paypalobjects.com/paypal-ui/logos/svg/paypal-color.svg\" alt=\"PayPalMe\" width=\"160\" /\u003e\u003c/a\u003e) \n\u003ca href=\"https://www.buymeacoffee.com/ashfaqalizardari\" target=\"_blank\" title=\"buymeacoffee.com/ashfaqalizardari\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" width=\"160\" /\u003e\u003c/a\u003e\n\n## :balance_scale: License\n  Copyright (c) Ashfaq Ali Zardari. All rights reserved.\n  \n  Licensed under the [MIT](https://github.com/AshfaqAliZardariOfficial/DatabaseHelper/blob/master/LICENSE) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashfaqalizardariofficial%2Fdatabasehelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashfaqalizardariofficial%2Fdatabasehelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashfaqalizardariofficial%2Fdatabasehelper/lists"}