Programming, technology, and CRM – from a Belgian programmer exiled to Missouri
  • rss
  • Home
  • Contact Me
  • Welcome

Raising Events in a SQL Server trigger

Nicolas Galler | August 31, 2007

For SQL 2005 you could do that from .NET obviously. But in SQL 2000 you have to resort to a shell command or an extended proc. I finally bit the bullet and researched how to create an extended proc, it was pretty easy. I just followed the instructions in MSDN, and used the following code in my proc:


__declspec(dllexport) SRVRETCODE xp_sss_raiseProcessQueueEvent(SRV_PROC * proc)
{
HANDLE evt = OpenEvent(EVENT_MODIFY_STATE, false, TEXT("SSSWorld.Rtsn.ProcessQueueEvent"));
if(evt != NULL){
SetEvent(evt);
CloseHandle(evt);
}
return 0;
}

One catch is that despite the __declspec magic, I had to create a .def file in order for SQL server to recognize the function. I probably missed some VC++ switch, but hey, this works.

Comments
No Comments »
Categories
Programming
Comments rss Comments rss
Trackback Trackback

Formatting localized date in the browser

Nicolas Galler | August 31, 2007

Well the closest I could get to this without making it a major ordeal was to use a VBScript section… I need something like “toLocaleShortDateString” in the Javascript but that doesn’t seem to exist (presumably because the short date format may not be defined on all OS’s). Obviously this will only work on IE.

<script language="vbscript">
Function formatShortDate(d)
formatShortDate = FormatDateTime(d, vbShortDate)
End Function
</script>

<script language="JavaScript">
alert(formatShortDate("2007-08-01 21:22:32"));
</script>

Oh yeah, FormatDateTime() won’t eat a Javascript Date object, and neither will CDate(). It has to be a string.

Comments
No Comments »
Categories
Programming
Comments rss Comments rss
Trackback Trackback

Categories

  • Experiments (4)
  • Interesting (1)
  • MSCRM (1)
  • Programming (60)
  • Rant (3)
  • Saleslogix (34)
  • Tricks (8)
  • Uncategorized (24)

Post History

  • 2010
    • January (3)
    • March (1)
  • 2009
    • March (2)
    • April (1)
    • May (3)
    • June (3)
    • July (1)
    • September (3)
    • October (2)
    • December (5)
  • 2008
    • January (9)
    • February (4)
    • March (9)
    • April (1)
    • May (5)
    • June (8)
    • July (1)
    • August (2)
    • September (1)
    • November (1)
    • December (3)
  • 2007
    • January (3)
    • February (7)
    • March (1)
    • April (3)
    • May (6)
    • June (2)
    • July (1)
    • August (2)
    • September (5)
    • October (3)
    • November (5)
    • December (4)
  • 2006
    • January (2)
    • September (1)
    • November (3)
    • December (4)
  • 2005
    • April (1)

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox