Wednesday, December 5, 2007

Ambiguous match found (C#.NET)

Ambiguous match found - Peter Johnson's Blog

I recently received this "Ambiguous match found" error in an app I had recently converted from visual studio 2003 to visual studio 2005. The error was particularly unhelpful in letting me know what the problem was. So, like always, I turned to Google in the hopes that someone else had had this issue. I found the page, linked to above, where I got this quote. I was particularly impressed had how similar this guys issue was. I am guessing that this error only plagues converted c# apps.

[quote] Other Google search results were similarly unhelpful, until I found the blog of a guy named Eran Sandler who talked about his "Ambiguous match found" error and how he solved it--two protected fields with names that differed only in case, apparently confusing reflection. [/quote]

Saturday, December 1, 2007

checking installed php packages

There is this really easy method of finding out what packages are installed for your current version of php.

just log onto your server and type
php -m
and it will display the list for you.

Saturday, November 24, 2007

Mount and Unmout ISO images in Ubuntu Linux

Recently I decided I needed to mount an ISO in Linux. I have done this many times in Windows and expected it to be even easier in Linux. Surprisingly Ubuntu didn't have a graphical tool for this, however some wonderful person created a couple of scripts and some easy install instructions to give us a graphical tool.

I am going to try this out tomorrow I hope.

"Some times you want to use iSO images without burning them.If you don’t want to waste your CD’s/DVD’s here is the simple possible solutions using these tips you can mount and unmount ISO images without burning them.
I know two possible solutions..."

Tuesday, November 20, 2007 membership returnURL & DestinationPageUrl

I have recently been having issues with my web application where we don't want the user redirected to the URL they were on after their session times out. Unfortunately I couldn't find anything that would turn off this functionality in Microsoft's membership block.

I read both of these pages which gave great information except that they didn't work for me:

In the end I created my own solution by putting the following code into the Page_Load method:
if (Request.QueryString.Get("ReturnURL") != "" && Request.QueryString.Get("ReturnURL") != null) Response.Redirect("~/login.aspx");

Monday, October 29, 2007

Installing DVD playing codecs on Ubuntu.

I have recently been having a lot of trouble with my MS Windows installations. I really like windows XP (not Vista), I just don't like the spyware, shareware and other junk that comes with it. Also the licensing issues have recently become such a nightmare that I have decided to switch to linux.

I have chosen Ubuntu as my distro of choice and things have been going great. Almost everything works out of the box. The few things that haven't have generally been because of licensing issues (in other words Ubuntu can't include the sofware I want because it isn't free).

My most recent hurtle has been making DVD's play on my Ubuntu installation. I ended up finding a great site (linked to above) which guided me to these two links:
After downloading the correct two packages for my machine ( they installed without any problems or headaches just link a Windows .exe file ) I was able to use MPlayer to play my DVD's. Totem still didn't work for them, but hey, that's ok, MPlayer is as good or better than any programs I could find for MS Windows, and it is free.

Here is a small excerpt from the site:
libdvdcss is a highly portable library for accessing and unscrambling DVDs encrypted with the CSS system. It is part of the VideoLAN project and is used by VLC and all other open source DVD players such as Ogle, xine-based players and MPlayer.
Installing w32codecs in Debian
#dpkg -i w32codecs_20060611-0.0_i386.deb
Installing liddvdcss2 in Debian
#dpkg -i libdvdcss2_1.2.9-0sarge0.0_i386.deb

I pasted the most important part of the site here in case they ever become unavailable. One of my biggest peeves on the web is people to link to something without giving me a summary or the critical information from the site, then having the link not work.

Monday, October 15, 2007

Restore your SQL Server database using transaction logs.

Restore your SQL Server database using transaction logs - Pr... Most DBAs dread hearing that they need to restore a database to a point in time, especially if the database is a production database. However, knowing how to do this is of the utmost importance for a DBA's skill set. I'll walk you through the steps of how to restore a SQL Server database to a point in time to recover a data table.

Thursday, October 11, 2007

Convert DataReader to DataSet

Code: Convert DataReader to DataSet ConvertDataReaderToDataSet: A great method to convert a data reader into a dataset.

Wednesday, October 3, 2007

A alphabetized HashTable

Due to the way a HashTable stores its keys and values they can't be natively alphabetized; it is optimized as a lookup system and that is what it is good at.

Other languages have objects like the TreeMap which can then be walked to be the items in sorted order.

In .NET if you want the functionality of the HashTable but have your list indexed on key rather than hash value, then you have to use the SortedList object. Personally I don't like the name, but I love the functionality, it is a great tool to be aware of.

It's namespace is:

Friday, September 28, 2007

Scrollable Table with fixed header using CSS

Scrollable Table with Fixed Header, repeat print header and ... This frozen / locked HTML table header is a usability advance done without HTML fakery such as hidden tables, frames, or JavaScript. Tested in (Windows) Mozilla-spawned browsers (incl. Netscape 6+ and Firefox) and IE5+. IE has problems with the screen behavior of the footer—but thanks to a clever expression provided by Renato Cherullo, even IE6 can have a modern footer. Mozilla self-induces display problems cramming the scrollbar into the last column, which can be corrected with advanced selector syntax. Surprisingly, both render the printed version of the table consistently well, including the repeated headers and footers. --------------------- Ever wanted to create a table to display data which head frozen headers and/or frozen footers like MS Excel allows? read this article to find out how. I have searched long and hard for a solution like this and now that I found such a simple one it is rather embarrassing that I didn't think of it myself.

using .resx files to localize web applications

How to use application resource files (.resx) to efficiently... You can use application resource files (.resx) to efficiently create a localizable Microsoft ASP.NET Web application. By using resource files, you can store localized values for controls. The localized values are based on a user’s language and culture. When you store localized values in resource files, ASP.NET can select the appropriate value at run time. ----------------------- This page describes how to create a localized resx file in Visual Studio.NET. essentially after the first resx default file is created you just copy it and insert an extension for the language code you are looking to support, make sure localization is turned on in your app and .net handles the rest.

Thursday, September 27, 2007

New method of hanging onto notes

I recently discovered Google's Bookmark feature which allows me to put a really cool javascript button on my toolbar. It isn't a complete replacement for the blog as it lacks easy access and search features, but as a basic and transportable bookmarking system it works really nice.

It's these extra little features that keep popping up that keep me with google.

SQL Where clauses: Avoid Case, use Boolean logic

SQL WHERE clauses: Avoid CASE, use Boolean logic As some of you may know, I recommend to avoid using CASE expressions in the WHERE clause of a query to express conditional logic. I prefer to have everything translated to simple ANDs, ORs and NOTs to keep things a) portable, b) easier to read and c) efficient. ------------ Apparently Coalesce() in the Where clause removes the queries ability to use an index for evaluating that column. Makes the code a tad bit messier but really good to know when to use boolean logic.

Tuesday, September 25, 2007

Download IE6 standalone dll's - Standalone IE6 for Testing Most users still use Internet Explorer 6, while most developers have upgraded to ie7. So how do you test in ie6? Most people designate another machine as an ie6 box, and then turnoff automatic updates. Oops, it was upgraded by the new guy. Nice. Anyway, for one reason or another it would be sweet to run both ie6 and ie7 on the same computer. After a lot of googling "ie6 side by side install" and "ie standalone" etc., and reading a bunch of crap, I found a nice standalone version at and a nice added dll from positioniseverything. So I zipped everything (link at bottom) and wrote these instructions. Enjoy!

Tuesday, September 18, 2007

Cast varchar to datetime

CodeGuru Forums - Convert a Varchar in a DateTime SELECT * FROM tab_val WHERE (CASE ISDATE(val) WHEN 1 THEN CAST(val As DateTime) ELSE NULL END) > CAST('2003-05-05 08:00:00.000' As DateTime) ------------------- When casting a varchar to a datetime it is critical that all the datetime pieces (such as minutes, seconds...) are in the string. Otherwise an error will be thrown.

Aspnet Membership Password manipulation

Brian Mishler on .Net - Asp.Net Membership Password Administ... The membership provider was designed to allow for self-service password management but through an understanding of the configuration options as well as a combined use certain provider methods, web site administrators can effectively manage member passwords. This article briefly summarizes the various settings and methods which can be combined to administratively manage passwords in an Asp.Net membership system based on the default SQLMembershipProvider. ------------------ This article give a good summary of how to manipulate passwords in the aspnet membership framework, including retrieval which is what I needed this time.

Friday, September 14, 2007

Portable Software on USB - Portable software for USB drives | Your D...


Now you can carry your favorite computer programs along with all of your bookmarks, settings, email and more with you. Use them on any Windows computer. All without leaving any personal data behind.

A very nice way of being able to carry some convenient pieces of software around on a USB drive for troubleshooting others systems.

Thursday, September 13, 2007

T-SQL Sproc timeout in .NET but not Management Studio

I recently had a rather odd problem which I have been unable to solve to my satisfaction so far.

The problem involves stored procedures which are compiled and cached. When calling the sproc from a 2.0 web application the call would timeout; however I could capture the call in SQL Profiler, run it in Management Studio and it would run great in sub second times.

The only solution I have found so far is to re-compile the sproc manually.
You could also try adding WITH RECOMPILE to the sproc and deal with the performance loss. This was suggested in a sqlteam thread:
A similar suggestion is on

After reading Ken Henderson's WebLog I am guessing that the cached plan is somehow getting corrupted and that running the code manually in Management Studio somehow uses a different cached plan. Perhaps plans are different for each user? Hopefully I can find and post a better solution.

Publish WebSite - precompiled

ASP.NET Deployment Tool

An avanced and robust Deployment Tool for precompiling your ASP.NET Websites! Pre-Compilation gives your site a performance boost and secures it. Precompile and deploy your Website for speed improvements and security, specific Error Panel, FTP Support, Deploy to Network, Merge Assemblies, easy to use.
A free addon type utility that can be used to precompile a .net website. Basically it compiles all the aspx and dll code into what the webserver typically does on first site access. The two benefits of this are: 1. no code aspx or cs is visible 2. website first load doesn't have any extra overhead downsides are: 1. the site has to be recompiled for any change 2. there are no relative paths anymore so moving the site or changing its directory could have disasterous results.
Microsoft has a built-in tool which has almost as many features as this tool, the big difference is that theirs doesn't come with the free edition of visual studio.

Wednesday, September 12, 2007 - Display inline PDF on webpage

Embed PDFs into a Web Page with a Custom Control - The Code ... This article describes an approach to embedding and displaying PDF documents in a web page through the use of a simple ASP.NET 2.0 custom server control. The approach indicated herein allows the developer the opportunity to control the web page content surrounding the embedded PDF; this is in contrast to linking directly to a PDF which uses the entire web page to display PDF but does not otherwise permit the developer to control the appearance of the page.

Honestly I think that this approach is an error prone and overbloan method of creating an IFrame. A much simpler method of accomplishing what I needed in this instance is:
System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath(cPage.RedirectURL));

Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/pdf";

Tuesday, September 11, 2007

Friday, September 7, 2007

CSS2 Reference

CSS2 Reference This page has a complete listing of all CSS properties and the values they can be set to. Very useful. It also has the well known and legendary name to add value to the content.

Left Join vs Left outer Join - Join vs Inner Join

Join vs Inner Join - dBforums Hi all, Can someone please describe whats the difference between: 1) Join vs Inner Join 2) Left join vs Left Outer Join TIA Falik ------------ According to this thread, the words Inner and Outer are optional in the Join syntax. This is something that wasn't ever really clear to me before so it is good to have it cleared up. The shorter code the better so I will happily stop using the non required words.

Tuesday, August 21, 2007

Can't truncate table with Foreign Key

When trying to truncate a table that is referenced by a Foreign Key I always get this message, even if the table referencing the primary table is empty.

Server: Msg 4712, Level 16, State 1, Line 1
Cannot truncate table 'actTouches' because it is being referenced by a FOREIGN KEY constraint.

To get around this problem I simply delete all rows from the table then re seed the identity column with 1.

Delete From [table]
DBCC CheckIdent ([table], RESEED, 1)

How to Insert Values into an Identity Column in SQL Server

Identity columns are commonly used as primary keys in database tables. These columns automatically assign a value for each new row inserted. But what if you want to insert your own value into the column? It's actually very easy to do.

The trick is to enable IDENTITY_INSERT for the table. That looks like this:


INSERT IdentityTable(TheIdentity, TheValue)
VALUES (3, 'First Row')


Here are some key points about IDENTITY_INSERT

* It can only be enabled on one table at a time. If you try to enable it on a second table while it is still enabled on a first table SQL Server will generate an error.
* When it is enabled on a table you must specify a value for the identity column.
* The user issuing the statement must own the object, be a system administrator (sysadmin role), be the database owner (dbo) or be a member of the db_ddladmin role in order to run the command.

Read the full article for more information. For instance the fact that this can modify the identity properties of your column depending on the values you update the table with.

Monday, August 20, 2007

SQL Server linked servers by IP

I struggled for quite a little while trying to execute this:
Select top 1 * From [].[db].[owner].[table]

In SQL2005 Management Studio against a SQL2000 box.

And receiving this:
An error occurred while executing batch. Error message is: Processing of results from SQL Server failed because of an invalid multipart name "", the current limit of "4" is insufficient.

I was unable to link the servers by name since there was no DNS to resolve it.

I finally discovered that I didn't receive the error if I simply used SQL 2000's Query analyzer. I was a little surprised to find that this issue in backwards compatibility existed in the Management Studio. I have not had a chance to test a SQL 2005 linked server to see if an IP address causes the same issue on it, though I would hope that it wouldn't.

Note: I just discovered that I was able to use OPENQUERY in Management Studio to run my query from one SQL2000 server to a linked SQL2000 server.

SELECT * FROM OPENQUERY([], 'SELECT * FROM [db].owner.[table]') AS tablename

Tuesday, August 14, 2007

DataGrid Default Paging

Paging in ASP.NET //Implement the EventHandler private void GridPageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; //Bind the DataGrid again with the Data Source DataGrid1.DataSource = dataSet1; DataGrid1.DataBind(); }

What is HanselMinutes?


What is Hanselminutes?

Hanselminutes is a weekly audio talk show with noted web developer and technologist Scott Hanselman and hosted by Carl Franklin. Scott discusses utilities and tools, gives practical how-to advice, and discusses ASP.NET or Windows issues and workarounds.

Monday, August 13, 2007

how to untar/tar

To get the files out of a tarball, you can use the following commands:

tar xvf something.tar

If the tarball has also been gzipped (compressed), you can use the following command:

tar xvfz something.tar.gz

The biggest thing that I always forget when trying to use this command is that it doesn't accept the "-" prefix before its modifiers like most other linux commands.

If you need to create a tar file
tar -cvzf name.tgz subdir
the 'z' is optional and gzips the file.
the 'v' is optional and gives a verbose output.

Wednesday, August 8, 2007

The ASP.NET Page lifecycle

15 Seconds : The ASP.NET Page Life Cycle When a page request is sent to the Web server, whether through a submission or location change, the page is run through a series of events during its creation and disposal. When we try to build ASP.NET pages and this execution cycle is not taken into account, we can cause a lot of headaches for ourselves. However, when used and manipulated correctly, a page's execution cycle can be an effective and powerful tool. Many developers are realizing that understanding what happens and when it happens is crucial to effectively writing ASP.NET pages or user controls. So let's examine in detail the ten events of an ASP.NET page, from creation to disposal. We will also see how to tap into these events to implant our own custom code. The events that get fired are: 1. Object Initialization 2. Load Viewstate Data 3. LoadPostData Processes Postback Data 4. Object Load 5. Raise PostBack Change Events 6. Process Client-Side PostBack Event 7. Prerender the Objects 8. ViewState Saved 9. Render To HTML 10. Disposal

Excerpt from another page I found helpful:
So, dynamically added controls must be programmatically added to the Web page on each and every page visit. The best time to add these controls is during the initialization stage of the page life cycle, which occurs before the load view state stage. That is, we want to have the control hierarchy complete before the load view state stage arrives. For this reason, it is best to create an event handler for the Page class's Init event in your code-behind class, and add your dynamic controls there.
Note You may be able to get away with loading your controls in the Page_Load event handler and maintaining the view state properly. It all depends on whether or not you are setting any properties of the dynamically loaded controls programmatically and, if so, when you're doing it relative to the Controls.Add(dynamicControl) line. A thorough discussion of this is a bit beyond the scope of this article, but the reason it may work is because the Controls property's Add() method recursively loads the parent's view state into its children, even though the load view state stage has passed.
Shortcut Summary:
1. Object Initialization
2. Load Viewstate Data (void LoadViewState( object o ) )
3. LoadPostData Processes Postback Data
4. Object Load (void onload(EventArgs e) )
5. Raise PostBack Change Events
6. Process Client-Side PostBack Event (void RaisePostBackEvent (string eventArgument) )
7. Prerender the Objects
8. ViewState Saved (void RaisePostDataChangeEvent() )
9. Render To HTML
10. Disposal (void OnPreRender( EventArgs e ) )

Tuesday, August 7, 2007

CAST and CONVERT (T-SQL) - datetime syntax



- 0 or 100 (*) Default mon dd yyyy hh:miAM (or PM)
1 101 USA mm/dd/yy
2 102 ANSI
3 103 British/French dd/mm/yy
4 104 German
5 105 Italian dd-mm-yy
6 106 - dd mon yy
7 107 - mon dd, yy
8 108 - hh:mm:ss
- 9 or 109 (*) Default + milliseconds mon dd yyyy hh:mi:ss:mmmAM (or PM)
10 110 USA mm-dd-yy
11 111 JAPAN yy/mm/dd
12 112 ISO yymmdd
- 13 or 113 (*) Europe default + milliseconds dd mon yyyy hh:mm:ss:mmm(24h)
14 114 - hh:mi:ss:mmm(24h)
- 20 or 120 (*) ODBC canonical yyyy-mm-dd hh:mi:ss(24h)
- 21 or 121 (*) ODBC canonical (with milliseconds) yyyy-mm-dd hh:mi:ss.mmm(24h)
* The default values (style 0 or 100, 9 or 109, 13 or 113, 20 or 120, and 21 or 121) always return the century (yyyy).

** Input when converting to datetime; Output when converting to character data.

CONVERT (data_type[(length)], expression [, style])

Monday, August 6, 2007

Javascript shorthand if statement syntax

Javascript Short-Hand IF Within Object Notation : Kinky Solu... var myVar = ( intDayOfWeek == 6 ) ? 3 : 0; Just a quick reminder for myself on how the short hand if statement syntax works for languages like php, javascript, and c#.

Wednesday, August 1, 2007

Password Reveal

A good little password finding utility that works on WinXP. It works by revealing the *****'d text that typically hides the text in a password field. This is not a password cracker.

Warning: It does try and connect to the internet when run for some unknown reason.

Monday, July 30, 2007

Accessing Cookies from Javascript

I recently had occasion to access the contents of a cookie stored on the clients computer using Javascript. I found the following javascript function very handy. I wander if something similar is built into javascript:

function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));

Stylesheet Link

Probably the easiest method of adding a link to an additional style sheet in code is this:

Page.Header.Controls.Add(new StylesheetLink("/css/mystyle.css"));

Thursday, July 26, 2007

A Look at GUIDs

Not many people enjoy using Globally Unique Identifiers (GUIDs), partly because they are cumbersome to type and work with for humans. However they fill a need and can provide some interesting benefits. SQL Server expert Andy Warren takes us through what a GUID is and how you can use it easily in your code.

The difference between Where and Group By

"The WHERE clause (# 3) evaluates data before the GROUP BY clause does. When you want to limit data after it's grouped, use HAVING. Often, the result will be the same whether you use WHERE or HAVING, but it's important to remember that the clauses are not interchangeable. Here's a good guideline to follow when you're in doubt: Use WHERE to filter records; use HAVING to filter groups.
Usually, you'll use HAVING to evaluate a group using an aggregate. For instance, the following statement returns a unique list of ZIP codes, but the list might not include every ZIP code in the underlying data source: SELECT ZIP, Count(ZIP) AS CustomersByZIP FROM Customers GROUP BY ZIP HAVING Count(ZIP) = 1
Only those groups with just one customer make it to the results. "

What Query Plans are in SQL Server's Memory?

"SQL Server memory is primarily used to store data (buffer) and query plans (procedure cache). In this article I'll show how much memory is allocated to the procedure cache (RAM). I'll explain how to determine what plans are in the cache and how often they're used.

SQL Server stores the procedure cache in 8KB data pages. You can use the dynamic management view sys.dm_os_memory_cache_counters to provide a summary of how the cache is allocated using this query"

LEFT([name], 20) as [name],
LEFT([type], 20) as [type],
[single_pages_kb] + [multi_pages_kb] AS cache_kb,
FROM sys.dm_os_memory_cache_counters
Order By single_pages_kb + multi_pages_kb DESC

What Data is in SQL Server's Memory?

"SQL Server memory is primarily used to store data (buffer) and query plans (cache). In this article I'll show how much memory is allocated to the data buffer (or RAM). I'll explain how to determine what tables and indexes are in the buffer memory of your server.

SQL Server stores its data in 8KB data pages. As these pages are read off disk they are stored in memory. This is referred to as buffer memory. A list of all the data pages in memory is stored in the dynamic management view sys.dm_os_buffer_descriptors."

Wednesday, July 25, 2007

Some Tips and Tricks for using an ObjectDataSource with a Gridview

Some Tips and Tricks for using an ObjectDataSource with a Gr... "This article attempts to show a few tricks with the new Gridview that we have in 2.0. This article addresses using the ObjectDataSource to populate the Gridview. In this example the ObjectDataSource returns a generic collection of an object. There is some special coding that needs to happen to get the sorting of colums to work. I also show how to use the pager template to do custom navigation. I have also included a simple Gridview printing example." A great reference for using the GridView control with a custom ObjectDataSource so you can do your own paging and sorting; an absolute must when working with large data sets.

using sp_executesql

T-SQL Programming Part 4 - Setting Variables in Calling T-SQ... use
use Northwind
declare @RECCNT int
declare @ORDID varchar(10)
declare @CMD Nvarchar(100)
set @ORDID = 10436
SET @CMD = 'SELECT @RECORDCNT=count(*) from [Orders]' +
' where OrderId < @ORDERID' print @CMD exec sp_executesql @CMD, N'@RECORDCNT int out, @ORDERID int', @RECCNT out, @ORDID print 'The number of records that have an OrderId' + ' greater than ' + @ORDID + ' is ' + cast(@RECCNT as char(5))

The name 'Session' does not exist in the current context

Geekpedia • ASP.NET: The name 'Session' does not exist in th... " This error normally occurs when you are trying to access the value of a session variable such as Session["UserID"] and you're not doing that from a webform, usercontrol or a class that inherits from System.Web.UI. In this situation you can still access the session variable, but using a different path. For example to access a session variable named UserID you would normally use Session["UserID"]; however, if the error The name 'Session' does not exist in the current context is returned, use the following path for retrieving the value of the session variable: " The fix is to use: HttpContext.Current.Session["variable"];

Tuesday, July 24, 2007

SQL Case - Syntax error converting the varchar value

variable order by when mixing datatypes? [Archive] - dBforum... Quote that helped me figure out a case problem with strings and ints: " In T-SQL, a CASE expression has its data type determined before the query is processed, and the type of the CASE expression is the lowest precedence type that is at least as high a precedence of each of the CASE alternatives. This means that a CASE expression with both varchar and int alternatives will be typed as int. The result of this is that whenever any of the alternatives is evaluated, it will be interpreted as an int, which in the case of a non-numeric varchar string, can cause a run-time error. If the value of a parameter is such that the non-numeric varchar is never accessed, this won't cause an error. You might think it would be better if the CASE expression weren't typed, but that would leave undetermined the question of how something like MAX(CASE when ColumnA = 0 then ColumnB else ColumnC end) should be evaluated. There is another alternative to handle this, and that is to cause the CASE expression to be of type sql_variant (needs SQL Server 2000), to which any numeric or varchar value can be cast, and which will preserve the correct ordering of each column according to its base type: "

GridView and the ObjectDataSource

TheDotNetGuy "Since, we are working with ObjectDataSource control we need to make an entity class. Take a look at the simple User class below:" It took me quite a while to figure out some of the subtle features that needed to be set in order to implement a custom paging setup for the GridView. These are the three most important things I learned: 1. an entity class is required for the ObjectDataSource to run off of. 2. If the ObjectDataSource's entity class is inside a namespace then the entire name (namespace included) must be given to the ObjectDataSource.TypeName and not just the class name. 3. It isn't enough to have public fields in the entity class as the GridView will only look at public properties (essentially a public field that acts like a method with get and set statements). Here is the other website that really helped out with this: "Well, it's not that I buy into what JayBaz says about properties. I was just hastily writing some test code without any regard to my flippancy. As soon as a changed the public fields to properties, TADA!" Here were the errors I was gettings: 1. The type specified in the TypeName property of ObjectDataSource 'objItem' could not be found. 2. The data source for GridView with id 'grdContacts' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.

Wednesday, July 18, 2007

Temporarily Changing sa password

Temporarily Changing an Unknown Password of the sa Account What if you need to log into a SQL server using a specific sql account? What if you don't know the password to said account, but you can't permanentally change the password because it is used other other processes? I can't really think of a reason this would be needed, however when I saw the article my first thought was "what a hacker hole". I haven't read the article in its entirety but it is a good thing to keep in the back of my mind as a possible security hole.

Tuesday, July 17, 2007

T-SQL Temporary Tables vs. Table variables

Lakeside SQL - Articles — Temporary Tables vs. Table Variabl...

1. There is no universal rule of when and where to use temporary tables or table variables. Try them both and experiment.

2. In your tests, verify both sides of the spectrum – small amount/number of records and the huge data sets.

3. Be careful with migrating to SQL 2005 when you use complicated logic in your stored procedures. The same code can run 10-100 times slower on SQL server 2005!

DataTable.Select problem, not finding rows

DataTable.Select problem in ASP.NET 2.0 I have noticed a problem with the DataTable.Select statement where .NET appears to convert all the data to string format. When I tried to do a select on an integer column passing in an integer value with a length that was different from most of the other integer values in the datatable, it wouldn't return any rows. It was really odd and I think should still work. This is what I call a but in .NET Anyway, the fix is to put ticks around the integer parameter in your select statement. Here is someone else's take on the matter: The data in your table probably isn't in integer form. Depends on you xml schema if you have one. If not they are probably all text type. Depending on how much you are using the data you might also want to look into serializing your xml and putting the data into a class that inherits the arraylist. This article may be of some assistants (read part one and two).

uniqueid clientid not evaluating

The CodeExpressionBuilder - Infinities Loop The unique ID and client ID of a control isn't established until its part of the control tree. Expressions are evaluated before they are added to the control tree, so its too soon. You could just use the databinding syntax instead, <%# button1.ClientID %>, and then be sure to call DataBind.

HtmlLink for javascript in head tag using jsLink

ASP.NET Resources - Code Blocks Inside Master Pages Cause Tr... javascript script tag dynamic in head element. similar to htmllink but for javascript.