This is a project that I made for use as a connection interface between my .net applications and SQL server. It will allow you to easily connect to a SQL server database, update data, insert data and return data using both T-SQL and Stored Procedures.
Example Usage
vb.net Code:
Imports BhmSoftware.DataAccess Imports BhmSoftware.DataAccess.SQLServerAccess Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'To create a Trusted Connection Dim sda As New SQLServerAccess sda.ServerName = "BRIANLAPTOP\SQLEXPRESS" sda.Database = "ADMS" sda.CreateConnectionString(True) Try If sda.CheckConnection() Then Dim dt As DataTable = sda.DataTableQuery("SOMEQUERY", _ New Parameter("@val", 14), New Parameter("@Val2", "Testing")) End If Catch ex As Exception MessageBox.Show(ex.Message) Finally sda = Nothing End Try 'To Create a Non Trusted Connection sda = New SQLServerAccess("BRIANLAPTOP\SQLEXPRESS", "DATABASE", "USERNAME", "PASSWORD") Try If sda.CheckConnection Then Dim dt As DataTable = sda.DataTableSproc("sp_SomeSproc", _ New Parameter("@P1", 100)) End If Catch ex As Exception MessageBox.Show(ex.Message) Finally sda = Nothing End Try End Sub End Class
Please let me know what you think and if you can find any place for improvement.






Reply With Quote