Wednesday, January 18, 2012

How to debug ActiveX dll’s (VB6)

How to debug ActiveX dll’s (VB6)

1.) Get the method call, i.e. getDetails("1206", "1601001", "guya", "2", vTable, WriteAccess, RowCount)
2.) Open VB project, change project properties from “ActiveX DLL” to “Standard EXE” and start-up object to “Sub Main”
3.) Add in a Sub Main constructor, doing so in a *.bas (not *.class) module is fine

Public Sub Main()

' Note that switching from an ActiveX DLL to a Standard EXE may/will change the ' class module “Instancing” property from “Multiuse” to “Private” (error: “No
' creatable public component detected". To get back to the ActiveX DLL change the ' class module “Instancing” property back to “Multiuse”

Dim sError, vTable, WriteAccess, RowCount
‘ name of class that contains the function to invoke

Dim foo As New cReports

‘ invoke function
sError = foo.getDetails("1206", "1601001", "guya", "2", vTable, WriteAccess, RowCount)

‘F8 – away!

‘modal for a breakpoint
MsgBox Command$, vbOK, "Command Line params"

End Sub

Tuesday, January 10, 2012

SQL Regex

http://beyondrelational.com/justlearned/posts/763/find-column-names-which-has-special-characters.aspx?utm_source=brnewsletter&utm_medium=email&utm_campaign=2012Jan

USE[]
02.GO
03.
04.SELECT tab.TABLE_NAME,col.COLUMN_NAME
05.FROM INFORMATION_SCHEMA.COLUMNS col
06.INNER JOIN INFORMATION_SCHEMA.TABLES tab
07.ON tab.Table_name = col.TABLE_NAME
08.WHERE tab.TABLE_TYPE = 'BASE TABLE'
09.AND
10.col.COLUMN_NAME LIKE '%[^a-zA-Z0-9]%'

Wednesday, January 4, 2012

SQL Server Table and Column with Extended Properties

USE FooBar
GO

CREATE TABLE dbo.tFoo (
ident INT IDENTITY (1, 1)
, PayCode CHAR (4) NOT NULL PRIMARY KEY
, GroupCode CHAR (16) DEFAULT ''
, GroupCodeDescription VARCHAR (256) DEFAULT ''
, crDate DATETIME DEFAULT GETDATE ()
, uDate DATETIME DEFAULT GETDATE ()
)

EXEC sys.sp_addextendedproperty
@name = N'tFoo - Purpose',
@value = N'Provide a logical extension to tBar without breaking any unknown unqualified inserts and provide a way to alert of any new paycodes that require a group association.',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'tFoo';
GO

EXEC sys.sp_addextendedproperty
@name = N'tFoo - PayCode',
@value = N'PayCode is the primary key and the foreign key to fBar.',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'tFoo',
@level2type = N'COLUMN',
@level2name = N'PayCode';
GO