Results 1 to 1 of 1

Thread: [2005] Sql Server DataAccess DLL

  1. #1

    Thread Starter
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    [2005] Sql Server DataAccess DLL

    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:
    1. Imports BhmSoftware.DataAccess
    2. Imports BhmSoftware.DataAccess.SQLServerAccess
    3. Public Class Form1
    4.  
    5.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    6.         'To create a Trusted Connection
    7.         Dim sda As New SQLServerAccess
    8.         sda.ServerName = "BRIANLAPTOP\SQLEXPRESS"
    9.         sda.Database = "ADMS"
    10.         sda.CreateConnectionString(True)
    11.         Try
    12.             If sda.CheckConnection() Then
    13.                 Dim dt As DataTable = sda.DataTableQuery("SOMEQUERY", _
    14.                     New Parameter("@val", 14), New Parameter("@Val2", "Testing"))
    15.             End If
    16.         Catch ex As Exception
    17.             MessageBox.Show(ex.Message)
    18.         Finally
    19.             sda = Nothing
    20.         End Try
    21.  
    22.  
    23.         'To Create a Non Trusted Connection
    24.         sda = New SQLServerAccess("BRIANLAPTOP\SQLEXPRESS", "DATABASE", "USERNAME", "PASSWORD")
    25.         Try
    26.             If sda.CheckConnection Then
    27.                 Dim dt As DataTable = sda.DataTableSproc("sp_SomeSproc", _
    28.                     New Parameter("@P1", 100))
    29.             End If
    30.         Catch ex As Exception
    31.             MessageBox.Show(ex.Message)
    32.         Finally
    33.             sda = Nothing
    34.         End Try
    35.  
    36.     End Sub
    37.  
    38. End Class

    Please let me know what you think and if you can find any place for improvement.
    Attached Files Attached Files
    Last edited by bmahler; Aug 2nd, 2007 at 04:30 PM.
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width