Salve, sto creando un piccolo web Method in asp.net ma purtroppo non sono molto pratico di .net, quando posso scegliere programmo in php quindi chiedo gentilmente un aiuto , non riesco a stampare a video nel web method il risultato di una stored procedures, inserisco qui di seguito il codice che ho utilizzato :
La stored procedures dovrebbe restituire un numero che puó essere 0, -1,-2,-3,-4 ed ogni numero corrisponde una cosa differente, il problema è che il web service restituisce -1 fisso in qualsiasi situazione.codice:[WebMethod] public string RegUsuario(string salutation, string firstname, string lastname, string lastname2, int companyid, int departamentoid, int cargoid, string cargodescripcion, string emailaddress, string phonenumber, string country, string state,string usuarioweb,string pwdweb,string razonsocial) { using (SqlConnection conn = new SqlConnection(datosConexion)) { conn.Open(); SqlCommand command = new SqlCommand("sp_orb_web_personAdd", conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("salutation", salutation); command.Parameters.AddWithValue("firstname", firstname); command.Parameters.AddWithValue("lastname", lastname); command.Parameters.AddWithValue("lastname2", lastname2); command.Parameters.AddWithValue("companyId", companyid); command.Parameters.AddWithValue("departamentoid", departamentoid); command.Parameters.AddWithValue("cargoid", cargoid); command.Parameters.AddWithValue("cargoDescripcion", cargodescripcion); command.Parameters.AddWithValue("emailAddress", emailaddress); command.Parameters.AddWithValue("phoneNumber", phonenumber); command.Parameters.AddWithValue("country", country); command.Parameters.AddWithValue("state", state); command.Parameters.AddWithValue("usuarioWeb", usuarioweb); command.Parameters.AddWithValue("pwdWeb", pwdweb); command.Parameters.AddWithValue("razonSocial", razonsocial); output = command.ExecuteNonQuery().ToString(); //output = command.ExecuteScalar().ToString(); /* IDataReader dr; dr = command.ExecuteReader(); //List each product. while (dr.Read()) { output = dr.GetString(0); } //Clean up. dr.Close(); */ //output= command.ExecuteScalar().ToString(); } return output;
Suggerimenti?

Rispondi quotando
