You are seeing an error because digital tasks on M-Series do not support an internal sample clock. Don't worry, you can still accomplish what you are trying to do. You will need to select a sample clock source since the digital system cannot create one for you. The easiest way to do this is to use a counter task to create a pulse train and use that as your clock. Then you would configure your timing to be something like:
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/Ctr0InternalOutput",1.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,10));