Server does not appear under network

Network discovery requires that the DNS Client, Function Discovery Resource Publication, SSDP Discovery, and UPnP Device Host services are started, you may check this on both sides to make sure they are started.

Error 49: Bad DLL calling convention

If you get this error for no apparent reason in MS Access then you probably just need to decompile the file like this

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "d:\My Documents\access\mayapp.mdb" /decompile

SQL Server "Optional Feature Not Implemented" Error Message

From here: https://support.microsoft.com/en-ca/help/214459/info-optional-feature-not-implemented-error-message

I got this error when running the code via MS Access VBA.

When you use ActiveX Data Objects (ADO) to pass parameters to a stored procedure, you may receive the following error:

Run-time error '2147217887 (80040e21)':
[Microsoft][ODBC SQL Server Driver] Optional Feature Not Implemented.

This error can occur if you attempt to set the TYPE of a parameter in an ADODB command object's parameters collection to a type that is not supported by the data provider.

For example, using SQL Server 7.0, create a stored procedure on the PUBS database:

   CREATE PROCEDURE GetEmployeeInfo (@thedate datetime, @NumEmployees int output)AS 
SELECT @NumEmployees = count(*) FROM EMPLOYEE WHERE hire_date < @thedate
GO

This stored procedure returns an output parameter of type int indicating the number of employees hired before a given date. The date is passed to the stored procedure as a parameter, and the number of employees is passed to the calling program as an output parameter.

Now create an ADO application to use the stored procedure. The example given is written in Visual Basic.

Private Sub MySubroutine()
Dim dbConnection As ADODB.Connection
Dim dbCommand As ADODB.Command

Set dbConnection = New ADODB.Connection
Set dbCommand = New ADODB.Command

Dim DSNNAME As String
Dim USERNAME As String
Dim PASSWORD As String

DSNNAME = "Pubs"
USERNAME = "sa"
PASSWORD = ""

dbConnection.Open DSNNAME, USERNAME, PASSWORD
dbCommand.ActiveConnection = dbConnection

Dim TheDate As Date
TheDate = Now

dbCommand.CommandText = "GetEmployeeInfo"
dbCommand.CommandType = adCmdStoredProc
dbCommand.Parameters.Append dbCommand.CreateParameter("@thedate", adDBDate, adParamInput, 0, TheDate)
dbCommand.Parameters.Append dbCommand.CreateParameter("@NumEmployees", adInteger, adParamOutput, 0)
dbCommand.Execute

Dim strTheString As String
strTheString = "There are " & dbCommand.Parameters("@numemployees") & " employees who were hired before " & TheDate
MsgBox strTheString, vbOKOnly, "Demonstration"
End Sub

When the sample code is run, it gives this error:

Run-time error '2147217887 (80040e21)':
[Microsoft][ODBC SQL Server Driver] Optional feature not Implemented.

This is because SQL Server does not support the adDBDate datatype. To correct this problem, change the datatype of the @theDate parameter to adDBTimeStamp.

In order to determine the number, names, types, and sizes of parameters needed in a stored procedure, use the Parameters.Refresh method of the command object. You can call this method during development of your application to determine the correct requirements for the stored procedure, then remove the expensive call to Parameters.Refresh after you have gathered the necessary data.

VBA Breakpoints don't work anymore

If you all of a sudden find that your VBA breakpoints do not work then check the "Use Access Special Keys" checkbox via Access Options/Current Database. More than likely it is NOT checked. Maybe you accidently unchecked it!

Can't delete folders because thumbs.db is in use

Specificy for Windows 7.

Please try Disable the generation of thumbs.db files by the Local Group Policy Editor and your problems will be resolved. They are only generated for compatibility with outdated applications, and are most certainly NOT needed for Windows operation.

Run "Group Policy" - select Edit Group Policy when it comes up.

> User Configuration
> Administrative Templates
> Windows Components
> Windows Explorer

 

How to fetch the row count for all tables in a SQL SERVER database

CREATE TABLE #counts
(
    table_name varchar(255),
    row_count int
)

EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC
DROP TABLE #counts

 

The output will be a list of tables and their row counts.

If you just want the total row count across the whole database, appending:

SELECT SUM(row_count) AS total_row_count FROM #counts

will get you a single value for the total number of rows in the whole database.

IIS complains about a locked section - how can I find out where it's locked?

From here: http://serverfault.com/questions/360438/iis-complains-about-a-locked-section-how-can-i-find-out-where-its-locked

I have this section in my web.config:
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <security>
        <authentication>
            <anonymousAuthentication enabled="true" />
            <windowsAuthentication enabled="true" />
        </authentication>
    </security>
</system.webServer>

IIS7 crashes and complains about the autientication section:

Module AnonymousAuthenticationModule
     Notification   AuthenticateRequest
     Handler    StaticFile
     Error Code 0x80070021
     Config Error   This configuration section cannot be used at this path.
This happens when the section is locked at a parent level.
Locking is either by default (overrideModeDefault="Deny"),
or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".


How to Fix.
1.Open IIS Manager
2.Click the server name in the tree on the left
3.Right hand pane, Management section, double click Configuration Editor
4.At the top, choose the section system.webServer/security/authentication/anonymousAuthentication
5.Right hand pane, click Unlock Section
6.At the top, choose the section system.webServer/security/authentication/windowsAuthentication
7.Right hand pane, click Unlock Section

 

 

 

The Report Viewer Web Control requires a System.Web.UI.ScriptManager on the web form

On the report form, add a script manager from the toolbox before the report control: open the toolbox and select Ajax Extensions - Script Manager, then drag it onto the form. Using Visual Studio 2012, what I ended up with was the following new control on the form:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

Full details for Visual Studio 2012 at http://msdn.microsoft.com/en-us/library/ms252104.aspx

IE renders PDF as binary or not at all via Crystal Reports Viewer.

From here: https://social.msdn.microsoft.com/Forums/ie/en-US/2530fbe4-b594-4aca-a086-23fb74c2b1cc/response-contenttype-applicationpdf-not-working-in-ie-11?forum=iewebdevelopment&prof=required

Tools>Internet Options>Advanced tab, uncheck "Do not save encrypted files to disk"

PDF is not natively supported in MSIE browsers... You need an installed and enabled PDF file reader ActiveX control to render the PDF file stream.