© 2010, DataObjx L.L.C. Meriden Connecticut USA

DataObjx L.L.C.

DataObjx is a participant in the Microsoft Independent Software Vendor program

Custom built desktop applications utilizing the Microsoft .NET Technologies...

Custom Web & Desktop Application Development

DAL-VistaDB - Insert, Update & Delete Examples

  Private Sub btnUpdateData()

       Dim SQL As String = ""

       SQL = SQL & "Update tblUsers Set first_name = 'Tommy', last_name = 'Thumbs' Where ID = 2"

  1)  Dim DAL As New DataAccessLayer.VistaDB

  2)  DAL.ConnectionString = "Your connection string here..."

  3)  DAL.ExecuteNonQuery(SQL)  

  End Sub

Example Usage - Insert, Update and Delete Data

Demonstrates the DAL performing a SQL Update  statement in three (3) lines of code.

In Step 1 The DAL is instantiated.

In Step 2 The Connection String to your SQL Server database is applied to the DAL and

In Step 3 The SQL command is executed

  Private Sub btnDeleteData()

       Dim SQL As String = ""

       SQL = SQL & "Delete From tblUsers  Where ID = 2"

  1)  Dim DAL As New DataAccessLayer.VistaDB

  2)  DAL.ConnectionString = "Your connection string here..."

  3)  DAL.ExecuteNonQuery(SQL)  

  End Sub

  Private Sub btnInsertData()

       Dim SQL As String = ""

       SQL = SQL & "Insert Into tblUsers (last_name,first_name, password, login) "

       SQL = SQL & "Values "

       SQL = SQL & "('Thumb','Tom','fingers','smallguy') "

  1)  Dim DAL As New DataAccessLayer.VistaDB

  2)  DAL.ConnectionString = "Your connection string here..."

  3)  DAL.ExecuteQuery(SQL)  'Execute & get the Primary Key (ID) of the new record

       MsgBox("@@IDENTITY = " & DAL.PKID.ToString, MsgBoxStyle.Information, "PKID")

   End Sub

Buy DataAccessLayerSQLVistaDB