Tuesday, October 09, 2012

SQL Connection and Command Example

Private Function IsClientAdmitted(ClientID As Integer) As BooleanDim conn As SqlConnectionDim cmd As New SqlCommandDim passOrFail As StringpassOrFail = Falseconn = New SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString())
Trycmd.CommandText = "csp_validate_progress_notes_entry"cmd.CommandType = CommandType.StoredProcedurecmd.Connection = conn
cmd.Parameters.Add(
"@ClientID", SqlDbType.Int).Value = ClientIDcmd.Connection.Open()
passOrFail = cmd.ExecuteScalar()

Return passOrFail
Catch ex As ExceptionRaiseEvent StatusMessageChanged(New StatusMessageEventArgs("Error Connecting to Database", StatusMessageEventArgs.StatusMessageType.ErrorMsg))
Return passOrFail
FinallyIf Not conn Is Nothing Thenconn.Close()End IfEnd TryEnd Function

Friday, September 28, 2012

10. Ctrl+Alt+plus sign (+)—Dealing with capturing screen images from a Remote Desktop session can be a mystery. If you press Print Screen, you get an image of your local desktop—not the remote desktop. Pressing the Ctrl+Alt+plus sign (+) keyboard shortcut captures a snapshot of the entire client window area of Remote Desktop and is the same as pressing Print Screen on your local desktop.
9. Ctrl+Alt+minus sign (-)—Sometimes you don't want an image of the entire desktop; sometimes you want just a selected window. Pressing the Ctrl+Alt+minus sign (-) keyboard shortcut captures a snapshot of just the active window within the remote desktop session. This key combination is the same as pressing Alt+Print Screen on your local desktop.
8. Alt+Home—Pressing the Alt+Home keyboard combination with Remote Desktop displays the Start menu on the remote system. The Start menu gives you quick access to the different programs installed on the remote system. This key combination is the same as pressing the Windows key on your local desktop.
7. Alt+Delete—Pressing the Alt+Delete keyboard combination in the Remote Desktop session opens the Windows menu of an application running on the remote system. The Windows menu is typically displayed under the icon in the extreme upper left corner of most Windows applications, and it lets you move and resize the application.
6. Ctrl+Alt+Break—Sometimes you might want the Remote Desktop window to be displayed in full-screen mode just as if you were using your local desktop. If you want to toggle the Remote Desktop session between a window and a full-screen display, you can press the Ctrl+Alt+Break keyboard combination.
5. Ctrl+Alt+Pause—Like the previous item, the Ctrl+Alt+Pause keyboard combination switches between full screen and windowed mode. However, with this keyboard shortcut, the remote desktop window remains at its standard size and doesn't fill the entire local desktop. Instead, it's displayed on a black background.
4. Alt+Insert—Sometimes you want a quick way to switch between the different programs that you have running. Pressing the Alt+Insert keyboard combination lets you cycle through the programs on the remote system in the order that they were opened. This process is the same as using Alt+Tab on your local desktop.
3. Alt+Page Down—Another way to cycle through the running programs on your Remote Desktop session is to use the Alt+Page Down keyboard shortcut. Pressing this key combination lets you switch between programs on the remote desktop session, moving from right to left in the Windows task switcher. This is the same as Alt+Shift+Tab on your standard desktop.
2. Alt+Page Up—Pressing Alt+Page Up lets you switch between programs on the Remote Desktop session, moving from left to right in the Windows task switcher. This is the same as Alt+Tab on your standard desktop.
1. Ctrl+Alt+End—One of the most common yet hard-to-find things that you'll need to do in a Remote Desktop session is to send a Ctrl+Alt+Del signal to the remote system. Press Ctrl+Alt+End if you need to send a Ctrl+Alt+Del keystroke combination to the remote system. This keystroke opens the Microsoft Windows Security dialog box, which lets you lock the computer, log off, change your password, and start Task Manager.

Monday, June 18, 2012

SharePoint 2010 User Profile Synchronization

Know the difference between FQDN and NETBIOS, before configuring SharePoint 2010 User Profile application be sure to know which one you need to use before setting up the Profile Application, because once setup you will have to delete the current application and perform a brand new full import.

http://blogs.msdn.com/b/russmax/archive/2010/03/20/sharepoint-2010-provisioning-user-profile-synchronization.aspx

Wednesday, September 14, 2011

SharePoint 2010 Day at Microsoft Campus in Charlotte

Getting questions answered and great overview of SharePoint 2010 for the current MOSS 2007 to SharePoint 2010 project I am currently working on in my current contract.

Friday, September 02, 2011

SharePoint 2007 & 2010 Index and Search sizes

If you need to review sizing of current implementation of SharePoint Index and Search
Go to > Central admin > Operations > Services on Server > Office SharePoint Server Search Service Settings
Copy the Default index file location : Run paste
Select and review properties that will provide the size of index
Next for Search simply navigate on SQL Server and right click on Search DB and review properties.
 

Wednesday, August 31, 2011

MOSS 2007 on Windows Server 2008 R2

I ran into a solution for getting Central Admin to display on Windows Server 2008 R2 today.   Basically you have to open IIS 7.0 and ensure that the Physical Path is correct.  For some reason the install had an incorrect physical path.   I fixed it and everything worked.

Next was installing MOSS 2007 SP2 slip stream on the rest of the farm.   Ensure you open the port that Central Admin is installed on or you will not be able to access.   LESSONS LEARNED FROM MOOJJOO

Saturday, March 26, 2011

Setup new URL

dotnet.mmwebs.com going to see if I can access blogger from work.

Friday, November 19, 2010

Add JavaScript to handle two scripts in ASP.NET

protected void ApplyJavaScriptForPostToIris()


{

System.Text.StringBuilder sbValid = new System.Text.StringBuilder();

sbValid.Append("if (confirm('Are you sure you want to post this file to app') == true){");

sbValid.Append("this.disabled = true;");



sbValid.Append("} else { return false;}");

sbValid.Append(this.ClientScript.GetPostBackEventReference(this.btnPostToIRIS, "") + ";");



this.btnPostToIRIS.Attributes.Add("onclick", sbValid.ToString());

}

Tuesday, November 09, 2010

Looping through SQL Server ... This has to be saved. To many hours spent.

I know I will have to do this again....

This article describes various methods that you can use to simulate a cursor-like FETCH-NEXT logic in a stored procedure, trigger, or Transact-SQL batch.


Use Transact-SQL Statements to Iterate Through a Result Set

There are three methods you can use to iterate through a result set by using Transact-SQL statements.



One method is the use of temp tables. With this method, you create a "snapshot" of the initial SELECT statement and use it as a basis for "cursoring." For example:

/********** example 1 **********/



declare @au_id char( 11 )



set rowcount 0

select * into #mytemp from authors



set rowcount 1



select @au_id = au_id from #mytemp



while @@rowcount <> 0

begin

set rowcount 0

select * from #mytemp where au_id = @au_id

delete #mytemp where au_id = @au_id



set rowcount 1

select @au_id = au_id from #mytemp

end

set rowcount 0







A second method is to use the min function to "walk" a table one row at a time. This method catches new rows that were added after the stored procedure begins execution, provided that the new row has a unique identifier greater than the current row that is being processed in the query. For example:

/********** example 2 **********/



declare @au_id char( 11 )



select @au_id = min( au_id ) from authors



while @au_id is not null

begin

select * from authors where au_id = @au_id

select @au_id = min( au_id ) from authors where au_id > @au_id

end





NOTE: Both example 1 and 2 assume that a unique identifier exists for each row in the source table. In some cases, no unique identifier may exist. If that is the case, you can modify the temp table method to use a newly created key column. For example:

/********** example 3 **********/



set rowcount 0

select NULL mykey, * into #mytemp from authors



set rowcount 1

update #mytemp set mykey = 1



while @@rowcount > 0

begin

set rowcount 0

select * from #mytemp where mykey = 1

delete #mytemp where mykey = 1

set rowcount 1

update #mytemp set mykey = 1

end

set rowcount 0











-- ================================================


-- Template generated from Template Explorer using:

-- Create Procedure (New Menu).SQL

--

-- Use the Specify Values for Template Parameters

-- command (Ctrl-Shift-M) to fill in the parameter

-- values below.

--

-- This block of comments will not be included in

-- the definition of the procedure.

-- ================================================

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: Robert Dannelly

-- Create date: 11/09/2010

-- Description: Resubmission Validation

-- =============================================

CREATE PROCEDURE ResubmissionValidation

-- Add the parameters for the stored procedure here

@ImportID int

AS

BEGIN

-- SET NOCOUNT ON added to prevent extra result sets from

-- interfering with SELECT statements.

SET NOCOUNT ON;



-- Insert statements for procedure here

DECLARE @ResubmissionTest TABLE

(

[ImportMetricID] [int] NULL,

[ImportID] [int] NULL,

[MetricInstanceID] [int] NULL,

[MetricValue] [varchar](100) NULL,

[NDTR] [varchar](20) NULL,

[MetricValueDate] [datetime] NULL,

[Narrative] [varchar](300) NULL,

[Resubmission] [varchar](50) NULL,

[ImportMetricStatus] [varchar](50) NULL,

[ImportFailureMsg] [varchar](200) NULL,

[CurrentMetricValue] [varchar](50) NULL

)



INSERT INTO @ResubmissionTest (ImportMetricID, ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue)

SELECT ImportMetricID, ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue FROM tblImportMetric WHERE ImportID = @ImportID --Need to change to Variable



-- This is used for Testing RBD

--SELECT * FROM @ResubmissionTest





DECLARE @ImportMetric_ID char(11), @Resubmission varchar(10)



SELECT @ImportMetric_ID = min(ImportMetricID) FROM @ResubmissionTest





--Begin LOOP

WHILE @ImportMetric_ID is not null

BEGIN

DECLARE @MetricInstanceID int,

@MetricValueDate DateTime



SELECT @MetricInstanceID MetricInstanceID FROM @ResubmissionTest WHERE ImportMetricID = @ImportMetric_ID



SELECT @MetricValueDate MetricValueDate FROM @ResubmissionTest WHERE ImportMetricID = @ImportMetric_ID

-- Be sure to change the values to @MetricInstanceID AND @MetricValueDate

EXECUTE ImportCheckResubmission @MetricInstanceID, @MetricValueDate, @Resubmission OUTPUT



IF @Resubmission = 'Yes'

BEGIN

UPDATE @ResubmissionTest

SET ImportFailureMsg = 'There is an existing value for this metric and interval. Please indicate if it is a resubmission.'

WHERE ImportMetricID = @ImportMetric_ID





SELECT @ImportMetric_ID = min(ImportMetricID) FROM @ResubmissionTest WHERE ImportMetricID > @ImportMetric_ID

END

END



DELETE FROM tblImportMetric WHERE ImportID = @ImportID



INSERT INTO tblImportMetric (ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue)

SELECT ImportID, MetricInstanceID, MetricValue, NDTR, MetricValueDate, Narrative,

Resubmission, ImportMetricStatus, ImportFailureMsg, CurrentMetricValue FROM @ResubmissionTest WHERE ImportID = @ImportID --Need to change to Variable





--This is used for Testing

--SELECT * FROM tblImportMetric

END

GO

Thursday, November 04, 2010

Demystify SQL Debugging with with Visual Studio

Here is what I did to fix this issue "FINALLY"

http://www.asp.net/data-access/tutorials/debugging-stored-procedures-vb
#1 Connect using Windows Authentication as the same account on the local machine that must have sysadmin rights in the Instance of SQL Server.
#2 They use Server Explorer and connect with that same account and then once connect right click on the DB and check "Application Debuggin. I am posting this to my blog.
Great posts. By the way I feel the pain of remote individuals, my answer tell you management that if you want fast, rapid code to fork up the dough for SQL Developer Edition and do all you coding locally with a quality source control.



Robert.

Tuesday, October 19, 2010

Add Using for Controls or lookup very useful

In VS 2008, when the caret is on the name of the class which doesnt have a using statement in the file, SHIFT+ALT+F10 will bring up a context menu to add the using statement.

Reboot Remotely

When you work in distributed environment you probably use remote desktop session as you primary method of sql server machines administration. When critical windows updates are installed or when you install system or sql server service pack installation wizard promts you to restart the box in order to complete the installation. And it happens from time to time that this  machine hangs on reboot process for some reason and you can no longer connect it via remote desktop. If it was you local computer you could enter into your server room and press the reset button but if it stand thousands miles away from you it becomes a real problem.
How to restart or shutdown remote machine
If you can ping this machine from other computer and you have administrators rights on that machine you may use windows utility.
On a computer that has connection to the server which needs to be restarted or shutdown go to Start -> Run and type shutdown -i

This window will show up. Press Add and type either IP or DNS of remote server.
Select shutdown or restart and press OK. That 's it. For your convenience you may run from command line constanct ping  (ping servername -t) when the server actually stopped to respond to pings and when it started again.
Alternatively you can go to command prompt (start -> run -> cmd) on your workstation and Typeshutdown -r -m \\x.x.x.x
Replace x.x.x.x with the IP address or computer name of the remote machine. -r option is for restart, don't use -r if want to just shut down the system.  

Thursday, August 05, 2010

SharePoint Site Collection Administration

Lesson learned. If you are ever asked to maintain a SharePoint site the first thing to do is say, "Grant me Site Collection Admin Rights". Why? Because if you are testing security and you do not know who the Site Collection Admin are then if you remove security the individuals in that role will still have access. (Nice 2 hour lesson learned)

Thursday, June 17, 2010

AJAX Install

If you develop ASP.NET applications with AJAX here is a step by step guide so you do not bang your head.

1) Download the latest version from CodePlex for AJAX.
2) Extract to a location of your choice
3) Add the AjaxControlToolkit.dll & AjaxControlToolkit.pdb to you Web layer project /bin folder
4) Create a new Tab in your Toolbox and point to the new AjaxControlToolkit.dll
5) Create a reference to your AjaxControlToolkit.dll
6) Finally ensure the line in your Web.config is that same version as your dll assembly - (Simply right click the dll and look at the properties for assembly info.

Friday, April 16, 2010

Visual Studio 2010

Microsoft has released Microsoft Visual Studio 2010. I think it is time for me to upgrade to Windows 7 and start using there new tool set in order to keep up with the times.

SharePoint and SQL Sever Reporting Integration

Well, I must tell you that I had to reach out to Microsoft yesterday and use 1 of my support calls with my MSDN Subscriptions. I have been tasked with integrated SQL Server Reporting Services with MOSS 2007.

This will be the first implmentation at my company and I very excited to have a fantastic presentation for my upper managment.

A lot of work has been put into this and I plan to sell this great feature.

Thursday, April 01, 2010

New Trick Envrionment Variables

public static string SecurePath = Environment.GetEnvironmentVariable("SECURED_APP_PATH");

You can right click on your computer > Advanced Tab > set the variables. Warning they will not take effect till a reboot.

This would not worth using for a hosted appllication when you do not have access to the server.

Monday, March 08, 2010

Time to build the app

I am ready to build the app for retirement. 1 to 2 hours a day.

Define - 20 more hours
- Design DB (Completed)
- Design Workflow (Completed)
- Design UI(s) All screens (Completed)
- Design Objects (Completed)
Measure - 10 hours (2-6 Months, but will be done before I am 40 :-) )
Analyze - 40 hours (Done)
Improve (Build) - (In Process)
- Database Development (8 Hours Completed)
- Application (Web to start in Progress 2-6 months
* Web UI
* Business Layer
* Data Layer (Completed)
* Test Test Test fix fix fix test test test
* Demo to friends and family (Huge Milestone - break out Beer and Wine)

Control - Will know after Improve Phase)