是否可以在 TableAdapter 的 CommandText 中添加回车和换行,以便查询结果在 ASP.Net GridView 中显示它们?
这是我使用 DataSet 设计器在 TableAdapter 中进行的查询的一部分:
SELECT AsthmaTreatment,
BookFee, ClinicWhenIll, DateOfBirth, Forename, GPA, Grade, HealthProblems, ID,
IllnessDetails, InjuryDetails, InsuranceCompany, InsurancePolicyNumber,
LanguagesSpoken, MedicinesTaken, ParentID,
(SELECT MotherName + ' *** ' + FatherName + '***' + CHAR(13) + CHAR(10) +
AddressLine1 + CHAR(13) + CHAR(10) +
AddressLine2 + CHAR(13) + CHAR(10) +
City + ', ' + State + ' ' + Zip AS Expr1
FROM Parents WHERE (ID = Students.ParentID)) AS ParentName,
PrimaryDoctor, PrimaryDoctorPhone, PrimaryPhone, SecondaryPhone,
SurgeryDetails, Surname, TuitionFee, email
FROM Students
WHERE (Forename LIKE '%' + @SearchValue + '%') OR
(Surname LIKE '%' + @SearchValue + '%') OR
(@SearchValue = 'ALL')
使用上述查询,显示 GridView 数据时没有回车符和换行符分隔数据行。
我们希望在 GridView 中显示这样的数据:
Ismail Eva *** Emad-ud-deen ***
123 Test St
Apt. 100
New York, NY 10021
Mustafa Eva *** Emad-ud-deen ***
333 First Ave.
Unit 3-B
Lowell, MA 01852