From you comment I can say that either dgvAttendanceHistory.CurrentRow
or dgvAttendanceHistory.CurrentRow.Cells("sms_text")
is Nothing
, so you need to test for that possibility first.
I'd like to point out the fact that you should really be using Parameters in your query instead of concatenating strings, as this opens a door for SQL injection attacks.
Cheers