The Temple of Fu

code, systems and games

Archive for the ‘Development’ 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

SSIS – File mapping object ‘Global\DTSQLIMPORT’ could not be opened. Operating system error code 2(The system cannot find the file specified.). Make sure you are accessing a local server via Windows security.

with 2 comments

Man one of these days Microsoft will make these error messages easier to understand. I am one of the ones that came from DTS land where after a few years things became comfortable; but in an effort to make things easier for us Microsoft gave us SQL Server Integration Services (SSIS) to overcome some of the DTS package shortcomings. Well they made my life a living hell in trying to learn this, well at least this particular task /rant.

The latest in my struggles is trying to deduce from the garbage that are SSIS messages what exactly I need to do to fix my error. The most recent being:
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "Could not bulk load because SSIS file mapping object 'Global\DTSQLIMPORT ' could not be opened. Operating system error code 2(The system cannot find the file specified.). Make sure you are accessing a local server via Windows security.".

What was I trying to do I will represent in this complicated flowchart.
Excel document –> SQL Server table

Confused yet? Me neither, If I were to do this with a DTS package it would have taken an hour tops but currently I am going on 4 hours! Not only am I battling Excel and it’s ‘here let me make this easier for you and guess what types or lengths your columns can hold’ productivity enhancements. I am also needing to deduce these bs error messages that are given at freaking runtime from within BIDS designer!
/rant #2

OK so the actual fix now is; instead of using a SQL Destination (even though you are inserting into SQL wtf) use an OLE DB Destination. The reason being to use a SQL destination you need to run the package on the machine that hosts SQL Server (destination). If you want to use a remote SQL Server, use OLEDB destination.

Hope that helps.

Written by lordfu

November 5, 2010 at 4:33 pm

Posted in Development, MSSQL, SSIS

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Ajax Toolkit – Update Panel and Datagrid download button

with 8 comments

So I have a datagrid which is a listing of files in a network share. I have a linkbutton in the grid with its text property set to a filename. This datagrid sits inside an UpdatePanel so it is all ‘Ajaxified’. When testing the command on the link button I received the following error.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Now I do understand why I received this error, I had modified the output stream back to the client via AddHeader methods etc but I need to in order to get this file back to client!

Well fortunately there is a way to tell the Ajax parser code on the client that content coming back was modified on the server side via script manager and also by registering the datagrid as a postback control.

ScriptManager _scriptManager = ScriptManager.GetCurrent(this.Page); _scriptManager.RegisterPostBackControl(myDataGridID);

Hope this helps!!

Written by lordfu

September 24, 2010 at 2:11 pm

Posted in Ajax, ASP.Net, C#, Development

Internet Explorer cannot display the webpage because of fileupload size

with one comment

So I was adding an input for the file upload control. Upon upload I would check the file size against a known size limit within my application. While testing trying to exceed the maximum upload size limit I was receiving from Internet Explorer a “..cannot display the web page error.” So I tried doing a try catch within the page to see if I could catch an error but the error couldn’t be caught there. Once I figured out that the error was never going to be caught there due to the nature of the request/response cycle I thought about trying to catch the error within Global.asax but that seemed hokey considering all I wanted to do was to display a message to the user that they had exceeded the limit. Well the answer lay in the web.config. What I needed to do was tell the web server (I was using Visual Studio built in) that it’s OK to allow file uploads of ‘X’ size. Where X is larger than the maximum size you want your application to allow for file uploads, in my case 5MB. So I added the following into the
system.web element of the web.config.
httpRuntime executionTimeout="600" maxRequestLength="6000"

I then throw an InvalidOperationException when checking for file upload size and catch that within my interface and display a nice friendly “sorry too large” message.

Hope that helps!

Written by lordfu

September 24, 2010 at 10:31 am

Posted in ASP.Net, Development

Single line if statement C#

leave a comment »

Who doesn’t like doing more in one line of code!

Here is a standard if else statement in C# .

if (Age == 36)
{
isMyAge = true;
}
else
{
isMyAge = false;
}

Here is the same as a single line.

isMyAge = (Age == 36) ? true : false;

Now obviously this is not a great example because the same code above could be shortened to

isMyAge = (Age == 36);

But you get the point 🙂

Written by lordfu

September 17, 2010 at 2:49 pm

Posted in ASP.Net, C#

Install Ajax Control Toolkit – Visual Studio 2008

with 4 comments

When you create a new ASP.NET application or web-site in VS 2008 that targets the .NET 3.5 framework, VS will automatically add the appropriate AJAX registrations in your web.config file and the core ASP.NET AJAX server controls will show up in your toolbox. This post shows you how to register the rest of the extensions in VS 2008.

Download the Ajax Control Toolkit

Click the Downloads tab at the CodePlex site to see the list of available Ajax Control Toolkit downloads. If you are using Visual Studio 2010 then you can use either the .NET 4 or .NET 3.5 versions of the Ajax Control Toolkit.

Download the Binary version and not the Source version of the Ajax Control Toolkit. You should download the Source version of the Ajax Control Toolkit only when you are interested in extending the Ajax Control Toolkit.

Extract the Download
After downloading the Ajax Control Toolkit, you need to unblock and extract the files. Right-click the compressed file and click the Unblock button.

Next, right-click the compressed file and select the Extract All menu option.

Add the Ajax Control Toolkit to the Visual Studio Toolbox
The next step is to add the Ajax Control Toolkit to the Visual Studio Toolbox. Follow these steps:

1. Launch Visual Studio and create a new ASP.NET Web Forms project or website. Open Default.aspx in the Visual Studio editor.
2. Create a new Toolbox tab by right-clicking the Toolbox and selecting Add Tab. Name the new tab Ajax Control Toolkit.
3. Right-click beneath the new tab and select the menu option Choose Items… Click the Browse button and browse to the folder where you extracted the Ajax Control Toolkit. Pick the AjaxControlToolkit.dll and click the OK button to close the Choose Toolbox Items dialog.

Hope that helps!

Written by lordfu

July 14, 2010 at 4:13 pm

Posted in Ajax, ASP.Net, Development