The Temple of Fu

code, systems and games

Archive for the ‘Visual Basic’ Category

Procedure or function X expects parameter Y, which was not supplied.

with 3 comments

I have been tracking down the source of this error for about an hour and a half.

“Procedure or function ‘procedure name’ expects parameter ‘@parameter_name’, which was not supplied.”

This is happening when I call a stored procedure with parameters through .Net’s data connection to SQL (System.data.SqlClient) and also through a WCF client proxy. The only way I was even able to see that error was via SQL Profiler and by executing the code it captured but that’s because we do not have good logging setup on our WCF endpoints yet. After much pain and debugging I found that it was because I forgot to add (or accidentally removed) a critical piece when setting this up, so yes it all comes down to user ID10T error but isn’t it always.

m_cmd.CommandType = CommandType.StoredProcedure

Hope this helps someone, off to refill my coffee cup!

Written by lordfu

August 30, 2012 at 9:52 am

Visual Studio – Method Auto Comment (XML Documentation) Not Working

with one comment

Opened up a project that was started by a fellow developer at work, I got_set_to_write_code and wanted to do what all good developers do, they comment their code! 🙂
I needed to add a method comment which can be triggered by typing three ticks ”’. It stubs out

But it didn’t work, grrr. The fix:
1. Go into project properties
2. Select the Compile tab.
3. Check ‘Generate XML documentation file’

Now the auto comment shortcut should work.

Written by lordfu

July 31, 2012 at 10:33 am

Move IIS Data Directory script

leave a comment »

I can’t remember how I got this script or from where but I have used it twice now so I am posting it here for others. If you are the original script author please let me know and i would be glad to tag it as such!

'------------------------------------------------------- '
' FILE: moveIISDataDirectory.vbs
' Used to migrate Web Data (FTP, WWW, SMTP) from drive C:\INETPUB to drive D:\INETPUB.
' This script can be modified to meet the need of any customers.
' Please do not remove this header info though.
'--------------------------------------------------------

'Stop IIS services before continuing

Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping all Internet Services..."
ret = WshShell.Run ("net stop iisadmin /y", 1, TRUE)

If ret = 0 then
WSHShell.PopUp "IISADMIN service was stopped successfully, continuing"
'restart()
else
WSHShell.PopUp "IISADMIN failed to stop successfully. The error code is " & ret Wscript.Quit 1
end if

' Modify IIS Metabase Properties for new data location
Dim params(7)
Dim x, ret
Dim params2(3) Params(0) = "w3svc/1/root/path d:\inetpub\wwwroot"
Params(1) = "w3svc/1/root/scripts/path d:\inetpub\scripts "
Params(2) = "w3svc/1/root/iissamples/path d:\inetpub\iissamples"
Params(3) = "msftpsvc/1/root/path d:\inetpub\ftproot"
Params(4) = "smtpsvc/1/BadMailDirectory d:\inetpub\mailroot\BadMail"
Params(5) = "smtpsvc/1/PickupDirectory d:\inetpub\mailroot\Pickup"
Params(6) = "smtpsvc/1/QueueDirectory d:\inetpub\mailroot\Queue"
Params(7) = "smtpsvc/1/DropDirectory d:\inetpub\mailroot\Drop"

Set WshSysEnv = WshShell.Environment("PROCESS")

For Each x In Params
ret = WSHShell.Run ("cscript.exe " & "c:\inetpub\adminscripts\adsutil.vbs SET " & x, 1, TRUE)
Next

' Verify Settings were successfully applied
If ret = 0 then
WSHShell.PopUp "The new metabase settings have been successfully updated. The new Web Data path is D:\inetpub"
else
WSHShell.PopUp "The Configuration changes failed. The error code is " & ret Wscript.Quit 1
end if

wscript.Sleep 5000

' Move Data to new location (D:\inetpub) using xcopy.exe (this can be changed from xcopy to move so the data is actually moved from current locale)
ret = WSHShell.Run ("xcopy c:\inetpub d:\inetpub\ /s /e /q" , 1, TRUE)

If ret = 0 then
WSHShell.PopUp "The data has been successfully moved to d:\inetpub"
else
WSHShell.PopUp "The data move failed. The error code is " & ret Wscript.Quit 1
end if

' Update Web Catalog to be for d:\inetpub 'Stop Content Index Service
Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping Index Service..."
ret = WshShell.Run ("net stop cisvc", 1, TRUE)

If ret = 0 then
chgeCat()
else
WSHShell.PopUp "Content Index service failed to stop successfully. The error code is " & ret Wscript.Quit 1
end if

Function chgeCat()
Set WshShell = WScript.CreateObject("WScript.Shell")

'Delete Catalogs '
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\"

' Delete Web Catalog. '
WshShell.RegDelete "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\System\"

' Delete System Catalog. 'Modify existing Web catalog entry
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\Location", "d:\inetpub"
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\IsIndexingW3Svc", 1, "REG_DWORD"
end function

'Start Services (WWW, FTP, SMTP, CISVC)
Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Attempting to restart stopped Services..."
Params2(0) = "w3svc"
Params2(1) = "msftpsvc"
Params2(2) = "cisvc"
Params2(3) = "smtpsvc"

For Each x In Params2
ret = WshShell.Run ("net start " & x, 1, TRUE)
wscript.Sleep 5000
Next

If ret = 0 then
WSHShell.PopUp "Services were started successfully, modifications complete"
else
WSHShell.PopUp "One or more services fail to start successfully. The error code is " & ret Wscript.Quit 1
end if

Written by lordfu

March 25, 2010 at 3:54 pm