Saturday, April 17, 2010

Microsoft SQL Server Management Studio 2008: Error 916

When using Microsoft SQL Server Management Studio 2008 to connect and manage a database
if you clicked the “Database” node within “Object Explorer” may received the message:
The server principal “username” is not able to access the database “databasename” under the current security context. (Microsoft SQL Server, Error: 916)
When you  clicked the “Database” node in the Object Explorer Panel in the background  SQL Server Management Studio 2008 execute an T-SQL query to retrieve a list of databases along with additional information about those databases, one of those information is collation, which didn’t have a permission to do for scan every database.
Fix:
  1. In Object Explorer, click Databases
  2. Display “Object Explorer Details” (F7) or “View –> Object Explorer Details”
  3. Right click the column headers and deselect “collation”
  4. Refresh Databases. 


Tuesday, February 2, 2010

Windows Media Player PARAM Elements

PARAM Elements in an OBJECT Element
Windows Media Player uses the PARAM element to define specific startup conditions for the control. The PARAM element is embedded inside the OBJECT element.
For example, if you want to define whether the autoStart property is True, you would embed the PARAM element inside the OBJECT element.


<OBJECT ID="Player"
  CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
    <PARAM name="autoStart" value="True">
</OBJECT>
You can have as many PARAM elements in an OBJECT element as you want. PARAM has two attributes, name and value. Both attributes must be set.
The supported PARAM attributes vary slightly among browsers and mime types. The following table shows the attributes supported by the Internet Explorer and Firefox browsers. The preferred mime type for the Firefox browser is application/x-ms-wmp, however, there are several other mime types that you can use to embed the Player control in a Web page hosted by the Firefox browser. The fourth column of the table shows the attributes that are supported when you use a mime type other than application/x-ms-wmp.
PARAM name Type Internet Explorer Firefox with mime type application/x-ms-wmp Firefox with any other mime type
autoStart Boolean, yes yes yes
balance Long, -100 to 100, default 0. yes yes yes
baseURL String , yes yes yes
captioningID String yes yes yes
currentMarker Long, default 0 yes yes yes
currentPosition Double, default 0 yes yes yes
defaultFrame String yes no no
enableContextMenu Boolean yes yes yes
enabled Boolean yes yes yes
enableErrorDialogs Boolean yes yes no
fileName String no yes yes
fullScreen Boolean yes no no
invokeURLs Boolean, default true yes no no
mute Boolean yes yes yes
playCount Long, 0 to ..n yes yes no
rate Double, default 1.0 yes yes yes
SAMIFileName String yes yes yes
SAMILang String yes yes yes
SAMIStyle String yes yes yes
SRC String no yes yes
stretchToFit Boolean, default false yes yes no
URL String yes yes yes
volume Long, 0 to ..n yes yes yes
windowlessVideo Boolean, default false yes yes yes

Note  The fileName and SRC PARAM elements are supported by the Firefox plug-in, but not by Internet Explorer. They both perform the same function as the URL PARAM element.
See the Object Model Reference for Scripting for more details about the values for each name attribute.

See Also

Using the Windows Media Player Control in a Web Page

Thursday, January 28, 2010

Configure Windows XP to Automatically Login

1. At a command prompt, type "control userpasswords2" and press Enter to open the Windows User Accounts application.
2. On the Users tab, clear the Users Must Enter A User Name And Password To Use This Computer check box and then click OK.
3. In the Automatically Log On dialog box that appears, type the user name and password for the account you want to be logged on each time you start your computer.

Saturday, January 16, 2010

How to remote connect to SQL Server 2005 by Specific TCP Port

SQL Server 2005 is not configured to accept remote connections. By default.

To allow remote connections, you have to complete all the following steps:

  • Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.
  • Configure SQL Server to Listen on a Specific TCP Port.
  • To open a port in Windows Firewall.
  • Connect to SQL Server 2005 by using MS SQL Server Management Studio with port number.

Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.
  1. Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Surface Area Configuration.
  2. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.
  3. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.

    Note Click OK when you receive the following message:
    Changes to Connection Settings will not take effect until you restart the Database Engine service.
  4. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Service, click Stop, wait until the MSSQLSERVER service stops, and then click Start to restart the MSSQLSERVER service.
Configure SQL Server to Listen on a Specific TCP Port
  1. In SQL Server Configuration Manager, in the console pane, expand SQL Server 2005 Network Configuration, expand Protocols for <instance name>, and then double-click TCP/IP.
  2. In the TCP/IP Properties dialog box, on the IP Addresses tab, all the IP addresses available in your computer is listed in here ... IP1, IP2, up to IPAll. Right-click one of address, and then click Properties to identify the IP address that you wish to configure.
  3. The TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports. Which means they select an available port when the SQL Server service is started. To disable listening dynamic port you can delete the 0 and left the blank.
  4. In the IPn Properties area box, in the TCP Port box, type the port number you wish this IP address to listen on, and then click OK.
  5. In the console pane, click SQL Server 2005 Services.
  6. In the details pane, right-click SQL Server (<instance name>) and then click restart, to stop and restart SQL Server.

To open a port in Windows Firewall
  1. On the Start menu, click Control Panel.
  2. In Control Panel, click Network and Internet Connections, and then open Windows Firewall.
  3. In Windows Firewall, click the Exceptions tab, and then click Add Port.
  4. In the Add a Port dialog box, in the Name box, type SQL Server <instanceName>.
  5. In the Port number box, type the port number of the Database Engine instance. Use 1433 for the default instance. Type 1500 if you are configuring a named instance and configured a fixed port to 1500 . Verify that TCP is selected, and then click OK
Connect to SQL Server 2005 by using MS SQL Server Management Studio with port number
  1. Open SQL Server Management Studio, In the Connect to Server dialog box, in the Server Name box type xxx.xxx.xxx.xxx\SQLEXPRESS,1500.
  2. type user name and password to connect to server.


Thursday, December 17, 2009

Windows Remote Desktop Web Connection ActiveX Reference

This articel help you understand how to use javascript create a customize windwos remote desktop web connection.
you can use this technic connect to your server desktop anywhere and the IE browser is all you need.
 
// Declare MsRdpClient object in the web page
    <OBJECT language="vbscript" ID="MsRdpClient" CLASSID="CLSID:7584c670-2274-4efb-b00b-d6aaba6d3850"
        onerror="OnControlLoadError"
        onreadystatechange="OnControlLoad"
        CODEBASE="msrdp.cab#version=5,2,3790,3959"
        WIDTH=<% resWidth = Request.QueryString("rW")
            if  resWidth < 200 or resWidth > 1600 then
               resWidth = 800
            end if
            Response.Write resWidth %>
        HEIGHT=<% resHeight = Request.QueryString("rH")
            if  resHeight < 200 or resHeight > 1200 then
               resHeight = 600
            end if
            Response.Write resHeight %>
    </OBJECT>
 
// Some Necessary input fields in web page
    Domain Name: <input type="text" name="Domain" id="editDomain">
    Screen Resolution:
    <select size="1" name="comboResolution" id=comboRes class="topspace">
        <option selected value="1"><ID id=option1>Full Screen</ID></option>
        <option value="2"><ID id=option2>640 x 480</ID></option>
        ....
        <option value="7"><ID id=option6>1600 x 1200</ID></option>
    </select>
   
    <input type="submit" id=connectbutton value="Connect" disabled="true" name="ButtonLogin" OnClick="RdpConnect">
 
// Validate MsRdpClient ActiveX is ready to load
    function onControlLoad
    {
       var control = document.getElementById("MsRdpClient");
       if(control == null)
       {
          if(control.readyState == 4)
          {
             document.getElementById("connectButton").disabled = false;
          }
       }
    }

// invok  connection to MsRdpClient object
function RdpConnect()
{
    MsRdpClient.Server="Server";
    MsRdpClient.Domain="Domain";
    MsRdpClient.UserName="user";
    MsRdpClient.AdvancedSettings2.ClearTextpassword="password";
    MsRdpClient.AdvancedSettings2.RDPPort = 3389;
    MsRdpClient.FullScreen=1;
    MsRdpClient.Width=1024;
    MsRdpClient.Height=768;
    MsRdpClient.DesktopWidth=1024;
    MsRdpClient.DesktopHeight=768;
    MsRdpClient.Connect();
}


MsRdpClient OCX Methods and controls reference:
    MsRdpClient.AdvancedSettings.PluginDlls
    MsRdpClient.AdvancedSettings2.AcceleratorPassthrough
    MsRdpClient.AdvancedSettings2.BitmapCacheSize
    MsRdpClient.AdvancedSettings2.BitmapPersistence
    MsRdpClient.AdvancedSettings2.BitmapVirtualCache16BppSize
    MsRdpClient.AdvancedSettings2.BitmapVirtualCache24BppSize
    MsRdpClient.AdvancedSettings2.BitmapVirtualCacheSize
    MsRdpClient.AdvancedSettings2.ClearTextPassword
    MsRdpClient.AdvancedSettings2.ConnectToServerConsole
    MsRdpClient.AdvancedSettings2.DedicatedTerminal
    MsRdpClient.AdvancedSettings2.DisableCtrlAltDel
    MsRdpClient.AdvancedSettings2.DisplayConnectionBar
    MsRdpClient.AdvancedSettings2.DoubleClickDetect
    MsRdpClient.AdvancedSettings2.EnableAutoReconnect
    MsRdpClient.AdvancedSettings2.EnableMouse
    MsRdpClient.AdvancedSettings2.EnableWindowsKey
    MsRdpClient.AdvancedSettings2.FullScreen
    MsRdpClient.AdvancedSettings2.GrabFocusOnConnect
    MsRdpClient.AdvancedSettings2.HotKeyAltEsc
    MsRdpClient.AdvancedSettings2.HotKeyAltShiftTab
    MsRdpClient.AdvancedSettings2.HotKeyAltSpace
    MsRdpClient.AdvancedSettings2.HotKeyAltTab
    MsRdpClient.AdvancedSettings2.HotKeyCtrlAltDel
    MsRdpClient.AdvancedSettings2.HotKeyCtrlEsc
    MsRdpClient.AdvancedSettings2.InputEventsAtOnce
    MsRdpClient.AdvancedSettings2.KeepAliveInterval
    MsRdpClient.AdvancedSettings2.KeyboardType
    MsRdpClient.AdvancedSettings2.MaxEventCount
    MsRdpClient.AdvancedSettings2.MaximizeShell
    MsRdpClient.AdvancedSettings2.MaxReconnectAttempts
    MsRdpClient.AdvancedSettings2.MinInputSendInterval
    MsRdpClient.AdvancedSettings2.MinutesToIdleTimeout
    MsRdpClient.AdvancedSettings2.NumBitmapCaches
    MsRdpClient.AdvancedSettings2.OrderDrawThreshold
    MsRdpClient.AdvancedSettings2.OverallConnectionTimeout
    MsRdpClient.AdvancedSettings2.PerformanceFlags
    MsRdpClient.AdvancedSettings2.PersistCacheDirectory
    MsRdpClient.AdvancedSettings2.PinConnectionBar
    MsRdpClient.AdvancedSettings2.RdpdrClipCleanTempDirString
    MsRdpClient.AdvancedSettings2.RdpdrClipPasteInfoString
    MsRdpClient.AdvancedSettings2.RdpdrLocalPrintingDocName
    MsRdpClient.AdvancedSettings2.RDPPort
    MsRdpClient.AdvancedSettings2.RedirectDrives
    MsRdpClient.AdvancedSettings2.RedirectPorts
    MsRdpClient.AdvancedSettings2.RedirectPrinters
    MsRdpClient.AdvancedSettings2.RedirectSmartCards
    MsRdpClient.AdvancedSettings2.ScaleBitmapCachesByBPP
    MsRdpClient.AdvancedSettings2.ShadowBitmap
    MsRdpClient.AdvancedSettings2.ShutdownTimeout
    MsRdpClient.AdvancedSettings2.SingleConnectionTimeout
    MsRdpClient.AdvancedSettings2.SmartSizing
    MsRdpClient.AdvancedSettings2.SmoothScroll
    MsRdpClient.AdvancedSettings3.ConnectionBarShowMinimizeButton
    MsRdpClient.AdvancedSettings3.ConnectionBarShowRestoreButton
    MsRdpClient.ColorDepth
    MsRdpClient.SecuredSettings.AudioRedirectionMode
    MsRdpClient.SecuredSettings.KeyboardHookMode
    MsRdpClient.SecuredSettings.StartProgram
    MsRdpClient.SecuredSettings.WorkDir


Related Links:
Installing Remote Desktop Web Connection in Windows XP
 
 

Sunday, November 29, 2009

ASP.NET WebService Samples

// Calling WebService Function for javascript
WebServiceObj.GetYourFunctionName(param1, param2, ..., onSucceeded, onFailed, userContext);

/**
* WebService onSuccess Callback function for AJAX.
* @param {Object} result               Can be any types return from WebService Function.
* @param {String} userContext      String can be pass into OnSucceeded or OnFailed Callback Function.
* @param {String} methodName    The WebService Name you called.
*/

function OnSucceeded(result, userContext, methodName)
{
    if (methodName == "GetSessionValue")
    {
        displayElement.innerHTML = "Current session state value: " + result;
    }
}
 
/**
* WebService onFailed Callback function for AJAX.
* @param {Object} result              The value retrun from WebService Function.
* @param {String} userContext     Any String you want pass into callback functions.
* @param {String} methodName   The WebService Function name you calling.
*/

function OnFailed(error, userContext, methodName)
{
    var stackTrace = error.get_stackTrace();
    var message = error.get_message();
    var statusCode = error.get_statusCode();
    var exceptionType = error.get_exceptionType();
    var timedout = error.get_timedOut();
    ...
    ...
}
 
 
Related Links:


SQL Server Collation Name

COLLATE  SQL_SortRules[_Pref]_CPCodepage_<ComparisonStyle>
Sample
COLLATE Chinese_Taiwan_Stroke
COLLATE Chinese_Taiwan_Stroke_BIN
COLLATE Chinese_Taiwan_Stroke_CI_AS
COLLATE Chinese_Taiwan_Bopomofo_CS_AI

SortRules
A string identifying the alphabet or language whose sorting rules are applied when dictionary sorting is specified.
Examples are Latin1_General, Polish or
Chinese_Taiwan.
Pref
Specifies uppercase preference.

Codepage
Specifies a one- to four-digit number that identifies the code page used by the collation. CP1 specifies code page 1252, for all other code pages the complete code page number is specified. For example, CP1251 specifies code page 1251 and CP850 specifies code page 850.

CaseSensitivityCI specifies case-insensitive, CS specifies case-sensitive.
AccentSensitivity
AI specifies accent-insensitive, AS specifies accent-sensitive.

BIN
Specifies the binary sort order to be used.

SQL Server Collation Name (Transact-SQL)
SQL Server 2005 Books Online (September 2007) - Collation Settings in Setup