C# を使用して SQL で列型 'uniqueidentifier' を読み込もうとしています
SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = "SELECT templatename, subject, bodyhtml, sender, emailTemplateBodyFields.fieldid FROM emailTemplates left join emailtemplaterecipients on emailtemplates.emailtemplateid = emailtemplaterecipients.emailtemplateid left join emailTemplateBodyFields on emailtemplates.emailtemplateid = emailTemplateBodyFields.emailtemplateid WHERE emailtemplates.emailtemplateid = " + selectedEmailTemplateID;
myCommand.Connection = connection;
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
NewTemplateName = myReader.GetString(0);
NewSubject = myReader.GetString(1);
NewBodyHTML = myReader.GetString(2);
NewRecipients = myReader.GetString(3);
myRecipientList.Add(NewRecipients);
Guid tempGUID = myReader.GetGuid(4);
NewBodyFields = Convert.ToString(tempGUID);
myBodyList.Add(NewBodyFields);
ただし、null 値の例外が発生しています。データは null です
Guid tempGUID = myReader.GetGuid(4);
SQL Server でステートメントを実行すると、列に null 値がありません。
この列から情報を取得する方法を教えてください。
ありがとう。