Google Ads

Monday, January 21, 2008

SQL1092N "" does not have the authority to perform the requested



First you need to make sure do you have SYSADM_GROUP setup

get dbm cfg

Probably you may want to update your SYSADM_GROUP to one of your Security group.
The command will be like this

update dbm cfg SYSADM_GROUP DB2ADMIN

http://publib.boulder.ibm.com/infocenter/db2v7luw/index.jsp?topic=/com.ibm.db2v7.doc/db2c4/db2c458.htm

If you are using Windows make sure you add your user Id back to the group of DB2ADMIN.

After that do a DB2STOP and START and retry your operation again. 

Sunday, January 20, 2008

Delete all data in all tables

-- disable referential integrity
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
GO

EXEC sp_MSForEachTable 'DELETE FROM ?'
GO

-- enable referential integrity again
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
GO

wow ...
Thanks for the tips from Adam

http://sqljunkies.com/WebLog/roman/archive/2006/03/03/18386.aspx

Wednesday, October 10, 2007

Window Installer Not working in Safe Mode?!

Here is the tips

1) REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\MSIServer" /VE /T REG_SZ /F /D "Service"
2) Start the service in your machine
net start msiserver


Note: This won't grantee to fix your problem, use it at your own risk.

Thursday, September 06, 2007

SQL0998N Error.

Environment

Microsoft Windows XP SP2 with IBM Db2 Client V8.2

Problem
SQL0998N, Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-8004D026". SALSTATE=58005, returned when COM component requires a transaction and the operating system is Microsoft Windows XP Service Pack 2.
 
Cause
Upgrading from Microsoft Windows XP Service Pak 1 to Service Pack 2
 
Solution

1) Change the following registry variable from:
[HKEY_CLASSES_ROOT\CLSID\{c8b522cb-5cf3-11ce-ade5-00aa0044773d}]
@="MSDASQL" "OLEDB_SERVICES"=dword:fffffff

Back to: ffffffffc

2) Register the following registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\XADLL]
"DB2APP.DLL"="C:\Program Files\IBM\SQLLIB\BIN\DB2APP.DLL"

3) Enable XA transaction support:
Component Services -> right click on My Computer -> Properties -> MSDTC tab -> click on Security Configuration -> check the 'XA Transactions' check box.



Thursday, June 21, 2007

SQL: NULL in database.

Today a new company trainee just remind me one thing when I try to compare a string with null values.

NULL in Database is not a value.

Yes right. In SQL NULL is treated as UNKNOWN value, which is different from empty string. So if you want to compare with NULL, you need to use "IS" or "IS NOT" statement. (keep reminding myself)

Luckly SQL has an extension to overcome this problem.

If you really want to compare NULL with a "=" or "<" or "<>" or ">" as a value. You can set the ANSI_NULLS to OFF.

For me personally I am a C# person. I am more likely to use "=" signs in store procedures.

However in simple testing query. I may be just "IS" or "IS NOT"

Error Handling: String VS StringBuilder

I am trying to output a format string to display. Then I came across an error. Hope you guys can advoid it.

As you may all know StringBuilder has performance advantages over complex string.
So what's the different between
String.Format
and
StringBuilder.AppendFormat

I've found it if the args number is not correct in string builder it will throw the following exception while string will not.

Error: {"Index (zero based) must be greater than or equal to zero and less than the size of the argument list." }



--
Cheers,

Gary

Wednesday, June 06, 2007

How to setup ActiveReport display footer only on the first page?

I am using Active Report 2.0. I try to display one of the footer object just display on the first page.

I found out a way to do it. To use the PageEnd event.
In the page end event, which is ending event of ever page generated.
so I need to write my code like this.

            if (this.PageNumber > 0 )
            {
               ABCTextBox.Visible=false;
            }


the next ABCTextBox visibility is set. Thus, I will only have this text box in the first page.

Friday, April 20, 2007

SQL Error: The object 'DF_ ' is dependent on column

This problem is happening while I want to alter my table column and it contains default value.

The following article solve the problem
http://support.microsoft.com/default.aspx?scid=kb;en-us;816755



Friday, April 13, 2007

Error from Windows Defender.

Application failed to initialize: 0x800106ba. A problem caused Windows Defender Service to stop. To start the service, restart your computer or search Help and Support on how to start a service manually.

I got this the other day. It basically means my Windows defender is expired.

All I need to do is to uninstall it and download the latest version of Windows Defender.

Download Link:
http://download.microsoft.com/download/e/d/0/ed099d5e-dc60-4740-8747-1c72f053b800/WindowsDefender.msi

Thursday, February 08, 2007

Error message: column does not belong to table

Problem

For some reason I got a big red cross whenever I try to save a datagrid.
It seems like happened in the following sequence.
1) The grid must be wider then your windows resolutions
2) open the grid, use the horizontal scroll bar go all the way to the right
3) modify something and hit save.

A Big red cross come up instead of the refreshed grid.

Solution

After try an error for a while I find out a simple solution is to set the grid data source to null before I use SetDataBinding ()
thus the code is something like this
                gridX.DataSource =null;
                gridX.SetDataBinding( XXXDataView, "" );
                gridX.Refresh();

--
Thanks,

Gary


--
Thanks,

Gary

Monday, October 23, 2006

Great Screen Shot Tools

Cropper in C#

Cropper is a screen capture utility written in C# on the Microsoft .Net platform. It makes it fast and easy to grab parts of your screen. Use it to easily crop out sections of vector graphic files such as Fireworks without having to flatten the files or open in a new editor. Use it to easily capture parts of a web site, including text and images. It's also great for writing documentation that needs images of your application or web site.

The files are saved straight to a folder of your choice in the format you specify or to the clipboard or printer. No more 'Print Screen'... open image editor... paste from clipboard... crop... export. Just double-click the form or press enter, and whatever is visible below the form is captured.

The source code is freely available with shared source licensing. The license information is available in each class file.


There are heaps other nice tools from Scott Hanselman's page

http://www.hanselman.com/blog/ScottHanselmans2005UltimateDeveloperAndPowerUsersToolList.aspx
--
Thanks,

Gary

Thursday, September 21, 2006

Tips: Prompt VS.Net Command Prompt in one click.

As we always using command prompt.. and we are usually too lazy to type cd ~ to your desire path.

Well, here is a quick way to do it.

You need to modify registry

here is the registry key

Type regedit then go to the following path

[HKEY_CLASSES_ROOT\Directory\shell\Visual Studio .NET 2003 Command Prompt]

 

[HKEY_CLASSES_ROOT\Directory\shell\Visual Studio .NET 2003 Command Prompt\command]

"cmd.exe %1 /K \"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat\""

 

note: %1 will be your highlighted directory.

you can add whatever you want may be you can just call is VS.Net Cmd other than .. the full name..

 

Cheers,

Gary

Handy Binder Formatter and Parser

This is a very old tricks. However it spend me a little time to get it back to my memory.

What is it for?

When we doing custom binding with a textbox or any string fields we always like to change the format to our desire pattern for example a money value in the database is 19 but we want to display it as $19.00 in our User friendly UI

We can add this binding tricks.

Implementation:

Databind()

{

      Binding dobinding = new Binding("Text", MyObject, "");

      dobinding += new ConvertEventHandler(doBinding_Format);

      dobinding += new ConvertEventHandler(doBinding_Parse);

      textBoxABC.DataBindings.Add(dobinding);

}

and then you just need to handle the event object and change it to return the output format.

you don't always need to do both Format and Parse, if you doing one way binding just for display.

 

Cheers,

Gary.


Reshaper UnitTest PlugIn Problem.


I tried 2 days to debug this problem.

I was trying to use the reshaper unittest plugin. It was running very good. I can just create a test function right click and Run Unit Test. Acutally it just like functionality that Test Driven.Net provided. Anyway, if everything in one Can why can't we just install one addin instead of two.

oh right.. my problem is that:

I added a test function.

then I modify the dll (the read code that I want to test) and build it.

while I am doing the debug. It always looking at the old version assembly. My latest code can never be apply to it.

To Fix this:

I found out that there is a temp dll sitting in my Application Data\assembly

and that's actually is the dll that I am testing.

They never get refresh.

Great! I removed it and it works.

Don't know if this is a Reshaper problem or my Visual Studio problem.

if anyone know why? please leave me a message.


--
Thanks,

Gary

Friday, September 15, 2006

Ten useful tools that must have

Here are ten essential tools that suggested by James Avery

CopySourceAsHTML
GhostDoc
TestDriven.NET
PInvoke.NET


For myself I recommended

XML Visualizer
SQL Prompt

Well my first Post here.
I'll make it a little bit detail later