An open API service indexing awesome lists of open source software.

https://github.com/gishreloaded/msdb-query

.NET Library for help of queries to database
https://github.com/gishreloaded/msdb-query

library mssql mssql-database query

Last synced: 2 months ago
JSON representation

.NET Library for help of queries to database

Awesome Lists containing this project

README

          

# msdb-query
.NET Library for help of queries to database

### Examples
```vb
Public Function InsertUser(ByVal email As String, ByVal name As String) As Boolean
Using connection As SqlConnection = SQL.sqlConnection(connectionString)

If SQL.Connect(connection) Then
Dim cmd As SqlCommand = New SqlCommand("[dbo].[InsertUser]", connection)
cmd.Parameters.AddWithValue("Email", email)
cmd.Parameters.AddWithValue("Name", name)
Dim success As Boolean = SQL.ExecuteNonQuery(cmd)
Return success
End If
End Using
End Function

Public Class UserModel

Public Property Id As Integer

Public Property RoleId As Integer

Public Property Email As String

Public Property Name As String
End Class

Public Function GetUsers() As List(Of UserModel)
Dim list As List(Of UserModel) = New List(Of UserModel)()

Using connection As SqlConnection = SQL.sqlConnection(connectionString)

If SQL.Connect(connection) Then
Dim cmd As SqlCommand = New SqlCommand("[dbo].[GetUsers]", connection)
Dim success As List(Of UserModel) = SQL.DataReader(Of UserModel)(cmd)
If success IsNot Nothing Then list.AddRange(success)
End If
End Using

Return list
End Function
```