Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<int> listatel=new List<int>();
- int tel = 0;
- string usuario = "";
- SqlDataReader oReader;
- SqlConnection cnn = new SqlConnection(CONEXION.STR);
- SqlCommand cmd = new SqlCommand("AgregarTelCliente" , cnn);
- cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.AddWithValue("@usuario",pusuario);
- cmd.Parameters.AddWithValue("@tel",telefono);
- SqlParameter oRetorno = new SqlParameter("@Retorno", SqlDbType.Int);
- oRetorno.Direction = ParameterDirection.ReturnValue;
- cmd.Parameters.Add(oRetorno);
- try
- {
- cnn.Open();
- oReader = cmd.ExecuteReader();
- if (oReader.Read()) //cuando ejecuto paso a paso,no llega al if!
- {
- usuario = (string)oReader["usuario"];
- tel = (int)oReader["telefonos"];
- listatel.Add(tel);
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- cnn.Close();
- }
Add Comment
Please, Sign In to add comment