Giter Club home page Giter Club logo

easysql's Introduction

EasySQL - C# Wrapper

** DO NOT USE THIS CODE IN PRODUCTION MODE, THIS CODE IS ONLY FOR TEST PURPOSES! **

EasySQL is a C# Wrapper that allow you to manage MySQL easily.

  • Easy to understand.
  • Fast and structured query result.
  • Easy to connect and dispose

Requirements to use EasySQL

  • MySQL NuGet package.

How to install

Compile this source-code and add as reference into your project.

How to use

Here is a simple introduction to how to use EasySQL:

Put our using in your project typing: using EasySQL.SQL;

Creating new connection:
SQL myConnection = new SQL("myUsername", "myPassword", "myDatabase", "127.0.0.1");

var conn = myConnection.CreateConnection();

if(conn)
{
    //You're connected
}
Inserting data:
List<string> keys = { "name", "number" };
List<object> values = { "Washington", 17 };

bool insertValues = myConnection.Insert("myTable", keys, values);

if(insertValues)
{
    //Data was inserted
}
Updating data:
List<string> keys = { "number" };
List<object> values = { 96 };

bool updateValues = myConnection.Update("myTable", keys, values, string.Format("name='{0}'", "Washington"));

if(updateValues)
{
    //Data was updated
}
Deleting data
bool deleteValues = myConnection.Delete("myTable", string.Format("name='{0}'", "Washington"));

if(deleteValues)
{
    //Data was deleted
}
Querying data
var Result = myConnection.Get("*", "myTable", "number=96");

if(Result.Count != 0)
{
    //has results
    foreach(var row in Result)
    {
        var nameColumn = row.GetValue(0).ToString();
        var countryColumn = row.GetValue(1).ToString();
        
        Console.WriteLine(string.Format("Name: {0} Number: {1}", nameColumn, countryColumn));
    }
}
Important

At the end of script remember to use the Dispose function to finish the connection! myConnection.Dispose();

TODO

  • Make it faster
  • Create best way to use conditional
  • Best security with conditionals, to block possible SQL Injection

Best regards, Washington

easysql's People

Contributors

was547 avatar vibrantgamesdev avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.