Thursday, October 18, 2012

Microsoft Exam 70-515 CSharp Sample Questions – 9

Microsoft Exam 70-515 CSharp Sample Questions – 9

Move Window between monitors with keystrokes

Windows 7 function to move an application window between monitors to be very useful (by default, it is bound to the Windows Logo key + Shift + left/right arrow).  

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