伙计们,我有一个查询返回许多税码。(取决于选择的文件编号)
//call method DoQuery and assign returned result to DataReader
DataReader = DoQuery("select oa.[OtherAmountCode] as 'Tax code'
FROM [Biatss_PC_SRV].[Pax].[SalesDocumentOtherAmount] as oa
INNER JOIN [Biatss_PC_SRV].[Pax].[SalesRelatedDocumentInformation]
as rd on oa.RelatedDocumentGuid = rd.RelatedDocumentGuid
INNER JOIN [Biatss_PC_SRV].[Pax].[SalesDocumentHeader] as h
on rd.HdrGuid = h.HdrGuid
where h.DocumentNumber = '"+txtTicketNumber.Text.ToString()+"'");
//check DataReader
if (DataReader == null)
{
DataReader.Close();
DataReader.Dispose();
}
else
{
if (DataReader.HasRows)
{
ReaderResult.Clear();
while (DataReader.Read())
{
for (int i = 0; i < DataReader.FieldCount; i++)
{
if (DataReader.IsDBNull(i))
{
string CaseNull = "";
ReaderResult.Add(CaseNull);
}
else
{
//put results in LIST<>
ReaderResult.Add(DataReader.GetString(i));
}
}
}
//I HAVE TO ASSIGN THE VALUES RETURNED TO textBox1 - textBox5 HERE
}
else
{
DataReader.Close();
DataReader.Dispose();
}
DataReader.Close();
DataReader.Dispose();
}
我有 5 个文本框。我不知道如何将税码分配给文本框。
我尝试了 IF-ELSE(以数据读取器中的行数作为参考),但通过这种方法,我无法将输出委托给不同的文本框。
知道如何实现这一目标吗?