\documentclass{article}
\usepackage{datatool,longtable,etoolbox}

% Toggle \iffalse/\iftrue to see behavior if patch is/is not in effect:

\iffalse
%\iftrue
\makeatletter
\expandafter\patchcmd\expandafter{\csname\string\DTLdisplaylongdb\endcsname}%
         {\@dtl@resetdoamp\dtldisplaystarttab}%
         {\dtldisplaystarttab\@dtl@resetdoamp}%
         {\message{Patching succeeded.}}%
         {\message{Patching failed.}}%
\makeatother
\fi

%===============================================================
\DTLnewdb{MyDataBase}%
\DTLaddcolumn{MyDataBase}{columnA}%
\DTLsetheader{MyDataBase}{columnA}{First Column}%
\DTLaddcolumn{MyDataBase}{columnB}%
\DTLsetheader{MyDataBase}{columnB}{Second Column}%
%---------------------------------------------------------------
\DTLnewrow{MyDataBase}
\DTLnewdbentry{MyDataBase}{columnA}{Row 1 Col A}
\DTLnewdbentry{MyDataBase}{columnB}{Row 1 Col B}
%---------------------------------------------------------------
\DTLnewrow{MyDataBase}
\DTLnewdbentry{MyDataBase}{columnA}{Row 2 Col A}
\DTLnewdbentry{MyDataBase}{columnB}{Row 2 Col B}
%===============================================================

\begin{document}

\begingroup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Without patching this doesn't work out but yields 
%  ! Misplaced \noalign.
\renewcommand{\dtldisplaystarttab}{\hline}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\dtldisplayafterhead{\hline}%
\renewcommand\dtldisplaystartrow{\hline}%
\renewcommand{\dtldisplayendtab}{\tabularnewline\hline}%
\renewcommand{\dtlbeforecols}{|}%
\renewcommand{\dtlaftercols}{|}%
\renewcommand{\dtlbetweencols}{|}%
\renewcommand\dtlheaderformat[1]{\textbf{#1}\hfil\null}%
\DTLdisplaylongdb{MyDataBase}
\endgroup

\end{document}