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
- Host: GitHub
- URL: https://github.com/gishreloaded/msdb-query
- Owner: GishReloaded
- Created: 2023-06-28T15:46:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-28T20:26:10.000Z (about 3 years ago)
- Last Synced: 2025-06-14T13:44:01.279Z (about 1 year ago)
- Topics: library, mssql, mssql-database, query
- Language: Visual Basic .NET
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```