Home » 2013

Archive for 2013

VB.NET – OleDbConnection Properties

Insert data using OleDbConnection Use ACE.OLEDB for databse connection (insert data) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As New OleDbConnection(“Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Projects\Northwind.accdb;Persist Security Info=False”) Dim CmdStr As String = “insert into sample _ (emp_name,category,city) _ values (‘” & TextBox2.Text & “‘,_ ‘” & TextBox3.Text & “‘,_ ‘” & […]

How to get GetConnectionString()

VB Public Shared Function GetConnectionString() As String Return ConfigurationManager.ConnectionStrings(“ConnectionString”).ToString() ‘ access properties ‘ if access driver is NOT installed on machine – most possible Return “Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=C:\Projects\MyProject\DataSource\ProjectDB.accdb” ‘ if access driver is installed on machine Return “DSN=CrescoOelweinMerger; DBQ=C:\Projects\MyProject\DataSource\ProjectDB.accdb” End Function C# Read more… public static string GetConnectionString() { return ConfigurationManager.ConnectionStrings[“ConnectionString”].ToString(); }

Delete old images – VB Script

Copy this code into notepad and save as DeleteOldImages.vbs ‘******************* Start of Code ************************* Option Explicit On Error Resume Next Dim oFSO, oFolder, sDirectoryPath Dim oFileCollection, oFile, sDir Dim iDaysOld ‘ Specify Directory Path From Where You want to clear the old files sDirectoryPath = “C:\Users\mike\Desktop\Test” ‘ Specify Number of Days Old File to Delete […]