Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 1==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- con = conex.f_getConexion();
- con.Open();
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 2==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- cmd = new SqlCommand("pa_man_EmpresaEmisorKey_Lis", con);
- cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.AddWithValue("@key", key);
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 3==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- SqlDataReader registros = cmd.ExecuteReader();
- Contribuyente obj = new Contribuyente();
- if (registros.Read())
- {
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 4==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- obj.IdContribuyente = Int32.Parse(registros["IdContribuyente"].ToString());
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 5==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- }
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 6==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- registros.Close();
- con.Close();
- return obj;
- }
- catch (Exception ex)
- {
- using (StreamWriter sw = File.AppendText(strPath))
- {
- sw.WriteLine("=============PASO 7==========");
- sw.WriteLine("===========fecha============= " + DateTime.Now);
- }
- throw;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement