cmd = new SqlCommand("INSERT INTO sms_sentmessages(Mobilefrom,Mobileto,Message,senddate) VALUES('" + str.Substring(0, str.Length - 4).ToString() + "','" + number + "','" + txtmessage.Text.Replace("'", "''").Trim() + "',getdate())", con);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
str.Substring(0, str.Length - 4)
and/ or
txtmessage.Text.Replace("'", "''").Trim()
are too large to fit with the column you're trying to insert into.