Refresh Crystal Report in VB.Net Using Saved Parameters

by Bill Dowling 17. July 2013 10:18
The following code can be used to refresh a Crystal Report file within a VB.Net program using the saved parameter values and output the results to a PDF file. It assumes you have a ReportDocument called rptDoc on your form. Me.UseWaitCursor = TrueMe.rptDoc.Load("T:\SummaryInvoice.rpt")Me.rptDoc.SetDatabaseLogon("user", "pw")'******************... [More]

Tags:

.Net Coding Examples | Crystal Report

SQL Statements for First and Last Date of a Month and Week

by Bill Dowling 17. June 2013 11:26
The following tsql statements can be used to get the first and last dates in a month. DECLARE @InputDate DATE=GETDATE() SELECT DAY(DATEADD(MONTH,DATEDIFF(MONTH,-1,@InputDate),-1)) AS DaysInMonth SELECT DATEADD(M,DATEDIFF(M, 0, @InputDate), 0) AS FirstDate SELECT DATEADD(D,-1,DATEADD(M,DATEDIFF(M,0,@InputDate)+1,0)) AS LastDate SELECT DATEADD(S,-1,D... [More]

Tags:

SQL Coding Examples

Generate Underlying Data From Excel Pivot Table

by Bill Dowling 2. April 2013 09:57
The following code will extract the underlying data that makes up a Pivot Table in Excel. Manually, if you double-click in a cell in the Total Row, you will get a new worksheet (tab) containing all the data that made up the Pivot Table. This routine will find all Pivot Tables, locate the total row and create a new worksheet (tab) with it's data. &n... [More]

Tags:

Excel

PrintHelperPages VB Class

by Bill Dowling 29. July 2011 12:49
Printing in a .Net (or any VB) program has always been a challenge. I developed the following VB.Net Class (with guidance from others) using Visual Studio 2010 to help simplify the printing process. This Class was developed to handle multi-page printed reports. Formatting and creating a multi-page printed report is done by a two step process. F... [More]

Tags:

.Net Coding Examples

GetSchema VB Subroutine

by Bill Dowling 30. July 2010 13:56
This VB Subroutine, gets Schema information (Column Name, Type, Size) from an Access DB Table. Private m_connDB As OleDbConnection = Nothing ' Current DB Connection Private m_sSchemaTable(1, 2) As String ' Table Schema Info Private Enum eSchemaFields As Integer ColumnName = 0 ColumnSize = 1 D... [More]

Tags:

.Net Coding Examples | Access DB

CellFormat VB Function

by Bill Dowling 29. July 2010 12:04
This code is used to call the CellFormat function to get a single Excel Cell '****************************** ' Open up the Excel Application '****************************** Dim xlApp As New Excel.Application xlApp.Visible = False xlApp.UserControl = False '****************** ' Open the workbook '****************** Dim xlWb As Excel.Workbo... [More]

Tags:

.Net Coding Examples | Excel

PrintHelper VB Class

by Bill Dowling 29. July 2010 09:33
Printing in a .Net (or any VB) program has always been a challenge. I developed the following VB.Net Class (with guidance from others) to help simplify the printing process. The class can be created with; Dim ph As New PrintHelper(_event, _font, _debug) _event As System.Drawing.Printing.PrintPageEventArgs From the Event Handler _f... [More]

Tags:

.Net Coding Examples

ufs_URLSite Scalar-Valued Function

by Bill Dowling 29. July 2010 08:22
Returns Web Site name from a URL line. USE [DB_Name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[ufs_URLSite] ( @URL varchar(2000) ) RETURNS varchar(255) AS BEGIN DECLARE @Result varchar(2000), @SearchFirst varchar(100), @SearchNext varchar(100), @Pos int S... [More]

Tags:

SQL Coding Examples

ufs_URLEncode Scalar-Valued Function

by Bill Dowling 29. July 2010 08:14
Returns encoded URL line. For example, all spaces are replaced with %20. USE [DB_Name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[ufs_URLEncode](@url varchar(1024)) RETURNS varchar(3072) AS BEGIN -- Peter DeBetta's SQL Programming Blog -- http://sqlblog.com/blogs/peter_debetta/archive/2007/03/09/t... [More]

Tags:

SQL Coding Examples

ufs_URLDecode Scalar-Valued Function

by Bill Dowling 29. July 2010 08:10
Returns decoded URL line. For example, %20 is replaced with a space. USE [DB_Name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE Function [dbo].[ufs_URLDecode](@url varchar(3072)) RETURNS varchar(3072) AS BEGIN -- Peter DeBetta's SQL Programming Blog -- http://sqlblog.com/blogs/peter_debetta/archive/2007/03/09/t-... [More]

Tags:

SQL Coding Examples

About the author

Bill Dowling has been a VB and .Net programmer for as long as he can remember.

Month List