\listfiles{}

\documentclass{article}
\usepackage{datatool}
\DTLnewdb{mydata}
\makeatletter
\define@cmdkeys{family}{firstname}[none]
\setkeys{family}{firstname=}%
\newcommand{\populatemydata}[2][]{%
  \dtlexpandnewvalue
  \setkeys{family}{#1}%
  \DTLnewrow{mydata}%
  \DTLnewdbentry{mydata}{Surname}{#2}%
  \DTLnewdbentry{mydata}{FirstName}{\cmdKV@family@firstname}
  \setkeys{family}{firstname=}%
}
\makeatother
\begin{document}
\populatemydata{Doe}
\populatemydata[firstname=John]{Doe}

\DTLdisplaydb{mydata}
\end{document}
