1
Edit: if anyone has the same problem as me, I solved by playing the " Pdfptable ID = new Pdfptable(1)" out to be a global var and put the "pdfdoc.add(ID)" part out of the while
So, for my work, I need to print a report, and I want to do a report identification, in the SQL database has already been created, but as I will add it to the code to print?
As an attempt, I used this code:
try
{
con.Open();
SqlDataReader registro = cmd.ExecuteReader();
while (registro.Read())
{
string id = registro["ID"].ToString();
PdfPTable ID = new PdfPTable(7);
ID.AddCell(registro["ID"].ToString());
pdfdoc.Add(ID);
}
con.Close()
}
catch
{
throw;
}