下午好,我在Sql的表中有以下数据
Comprobante Categoria
603552 A
624997 A
651880 A
672298 C
615985 C
613804 C
617970 A
625688 A
689463 B
611686 B
然后生成一个控制台应用程序,通过获取凭证编号并下载.pdf来查询WebService,但它会阻止我,此应用程序必须通过从Vouchers表中获取sql查询的值来按类别生成文件夹,在每个文件夹中,下载与该类别对应的发票,以便在每个文件夹中按类别对发票进行排序。我感谢所有的帮助。
static void Main(string[] args)
{
string url = null;
string strSQL = "SELECT numeroComprobante,categoria FROM Comprobantes";
SqlConnection con = new SqlConnection("********");
SqlCommand cmd = new SqlCommand(strSQL, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
var request = new Services.consultarDocumento()
{
request = new Services.requestConsultaDocumento()
{
numeroComprobante = reader["numeroComprobante"],
}
};
var address = new EndpointAddress(new Uri("*********"));
BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "basicHttpBinding";
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.Security.Mode = BasicHttpSecurityMode.None;
var client = new Services.ConsultaDocumentoClient(binding, address);
var response = client.consultarDocumento(request);
var Factura= @return.Documento;
}
reader.Close();
con.Close();
}
}