Exemplo n.º 1
0
        public String getComment(int id_item)
        {
            if (id_item == null) return "";
            String result = "";
            SqlConnection Conn = null;
            Conn = new SqlConnection(@DataControll.StringConnect());
            string strSQL = "GetCommentsByIDTOVAR";
            SqlCommand Cmd = new SqlCommand(strSQL, Conn);
            Cmd.CommandType = CommandType.StoredProcedure;
            Cmd.Parameters.Add("@id_tovar", id_item);

            SqlParameter f0 = new SqlParameter("@id_tovar", SqlDbType.Int);

            Conn.Open();
            SqlDataReader myReader = Cmd.ExecuteReader();
            int id_tovar = 0;
            while (myReader.Read())
            {

                id_tovar = myReader.GetInt32(0);
                String id_user = Convert.ToString(myReader.GetValue(1));
                Models.User usr=new Models.User();
                String username=usr.getLogin(myReader.GetInt32(1));
                id_tovar = 0;
                result = result + "<a href='#' onclick='getProfile("+id_user+")'><b> " + username + "</b></a> :" + myReader.GetString(3) + "<br>";

            }

            Conn.Close();
            return result;
        }