필드가 데이터베이스의 테이블에 실제로 존재하는지 확인하고 싶습니다. SqlDataReader 클래스를 사용하여 데이터를 읽었습니다. 값을 SqlDataReader에 할당 한 후 foreach를 사용하여 각 레코드를 반복하는 루프를 만들었습니다. 다음은 샘플 코드입니다.DbDataRecord에서 열의 존재 여부를 확인하는 데 사용되는 방법은 무엇입니까?
SqlCommand sqlCommand = new SqlCommand();
SqlDataReader sqlDr = sqlCommand.ExecuteReader();
Foreach(DbDataRecord record in sqlDr)
{
// Validate if the value is not null and (I want to validate if this field really exist in the table)
if(record["MyField1"].GetType().ToString() == "System.DBNull")
{
// Statement here
}
}
나는 친절한 답변을 바랍니다. 고맙습니다.
처럼 감사를 호출 .. ¬¬ –