Imports System.Data Public Class UsingMsAccess Private Sub AddNewRecord() 'Replace path to "accessdatabasepath" with the actual path to the ms access database 'example C:\testApp\data\mydata.mdb Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=accessdatabasepath" Dim dbConnection As DbConnection = New OleDbConnection(connectionString ) Dim queryStr As String = "SELECT [Employees].* FROM [Employees]" Dim dbCommand As DbCommand = New OleDbCommand dbConnection.Open() dbCommand.CommandText = queryString dbCommand.Connection = dbConnection Dim dataAdapter As DbDataAdapter = New OleDbDataAdapter Dim commandBuilder as DbCommandBuilder= New OleDbCommandBuilder(dataAdapter) dataAdapter.SelectCommand = dbCommand Dim MydataSet As DataSet = New DataSet dataAdapter.Fill(MydataSet,"Employees") 'where employees is the name of the datatable dim NewRow as datarow = MydataSet.tables("Employees").Newrow NewRow("Name") = "sammy" 'Replace ("Name") with your own table field name NewRow("Age") = 27 MydataSet.tables("Employees").Rows.Add(NewRow) dataAdapter.Update(MydataSet,"Employees") MydataSet.tables("Employees").AcceptChanges() End Sub
The programmer's notebook is a reference for programmers. Here you can find code snippet's for VB.Net, C# .Net, WPF and many more...
Pages
VB.net: connect to ms access database
Here's how to connect to an MS Access Database from VB.Net and add a new record. The sample code uses the OleDbConnection object as a means of connecting to the MS Access Database...
Open PDF File using Vb6
Code snippet to open a pdf file at a click of a button in vb6
Dim acroRdrPath As String, pdfFilePath As String Private Sub Command1_Click() acroRdrPath = "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" pdfFilePath = "c:\my documents\260_2C05.pdf" Shell acroRdrPath & " " & pdfFilePath , vbNormalFocus End Sub
XHTML: Open link in new window
the target attribute has been deliberately removed from xhtml, thus making it difficult for people getting started creating websites using xhtml unable to open links in new windows like in html. Here's the code to help you open a target link in a new window
add this to the head or to an external file which you can reference
then add the onlick event like this
add this to the head or to an external file which you can reference
function targetBlank (url) { blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes'); }
then add the onlick event like this
The test domain in a new window
Subscribe to:
Posts (Atom)